Search is not available for this dataset
name stringlengths 2 112 | description stringlengths 29 13k | source int64 1 7 | difficulty int64 0 25 | solution stringlengths 7 983k | language stringclasses 4
values |
|---|---|---|---|---|---|
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | N,K = map(int, input().split())
print(1 + -( -(N-K)//(K-1) ) )
| PYTHON3 |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | N, K = map(int, input().split())
print(-(-(N - 1) // (K - 1)))
| PYTHON3 |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
// 整数の入力
int n = sc.nextInt(),m = sc.nextInt();
int a[]=new int[n];
for(int i=0; i<n; i++) {
a[i]=sc.nextInt();
}
int min=-1;
for(int i=0; i<n; i++) {
if(min==-1||a[i]<min)mi... | JAVA |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | #include "bits/stdc++.h"
using namespace std;
int main() {
int n,k;
cin>>n>>k;
n-=k;
cout<<(n+k-2)/(k-1)+1<<endl;
return 0;
} | CPP |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | #include <iostream>
using namespace std;
int n, m;
int main() {
cin >> n >> m;
cout << (n - 2) / (m - 1) + 1 << '\n';
return 0;
} | CPP |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int k = scan.nextInt();
int ans = (int)Math.ceil((double)(n - 1)/ (k - 1));
System.out.println(ans);
}
} | JAVA |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | N, K = map(int, input().split())
print((N-2)//(K-1)+1)
| PYTHON3 |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | #include <bits/stdc++.h>
using namespace std;
int main(void)
{
int n,u;
cin>>n>>u;
cout<<1+ceil(float(n-u)/float(u-1));
return 0;
}
| CPP |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | import java.util.Scanner;
import java.util.ArrayList;
import java.util.List;
import java.util.Collections;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
List<Integer> a = new ArrayList<>();
int n = sc.nextInt();
int k = sc.nextInt();
... | JAVA |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | N,K=list(map(int, input().split()))
Q=0
print((N-1)//(K-1)+((N-1)%(K-1)>0)) | PYTHON3 |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | import math
n, k = map(int,input().split())
input()
print(math.ceil((n-1)/(k-1))) | PYTHON3 |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | #include<cstdio>
using namespace std;
int main(){
int n,k;
scanf("%d%d",&n,&k);
printf("%d\n",(n-1)/(k-1)+((n-1)%(k-1)>0));
return 0;
} | CPP |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | #include<bits/stdc++.h>
using namespace std;
int main() {
int n,k;
cin >> n >> k;
n--;
k--;
if(n%k==0) cout << n/k;
else cout << n/k+1;
} | CPP |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | n,k=map(int,input().split())
ans=1
while n>ans*(k-1)+1:
ans=ans+1
print(ans) | PYTHON3 |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | N, K = map(int,input().split())
Alist = list(map(int,input().split()))
print(-(-(N-1)//(K-1))) | PYTHON3 |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = Integer.parseInt(sc.next());
int k = Integer.parseInt(sc.next());
int[] a = new int[n];
int min = 100000;
for(int i=0; i<n; i++) {
... | JAVA |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | from math import ceil
a,b = map(int,input().split())
c = input()
print(ceil((a-1)/(b-1))) | PYTHON3 |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
int []a = new int[n];
int t = 0;
for(int i = 0; i < n ;i++) {
a[i] = sc.nextInt();
}
int p = n -1 ;
int q = k -1 ... | JAVA |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
int[] a = new int[n];
for (int i = 0; i < a.length; i++) {
a[i] = sc.nextInt();
}
... | JAVA |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | #include <iostream>
int main(){int n,k;std::cin>>n>>k;std::cout<<(n-2)/(k-1)+1;}
| CPP |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | n,k=map(int,input().split())
print((n-3+k)//(k-1)) | PYTHON3 |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
int[] arr = new int[n];
int idx = -1;
for(int i = 0; i < n; i++) {
arr[i] = sc.nextInt();
if(arr[i] ==... | JAVA |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int n = Integer.parseInt(sc.next());
int k = Integer.parseInt(sc.next());
long ans = (long)Math.ceil((double)(n-1)/(k-1));
System.out.printl... | JAVA |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n, k;
cin >> n >> k;
cout << (n - 1 + k - 2) / (k - 1) << endl;
return 0;
}
| CPP |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | #include<iostream>
using namespace std;
int a[100005];
int main(){
int N, K;
cin >> N >> K;
int ans = ((N - 1) + (K - 2))/(K - 1);
cout << ans << endl;
} | CPP |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
System.out.println((n + k - 3) / (k - 1));
}
}
| JAVA |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | N, K = list(map(int, input().split()))
print((N-1)//(K-1)+bool((N-1)%(K-1)))
| PYTHON3 |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | n, k = map(int, input().split())
aa=input()
print(-(-(n-1) // (k-1)))
| PYTHON3 |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | #include <bits/stdc++.h>
using namespace std;
int main(){
int N, K;
cin >> N >> K;
cout << (N - 1 + K - 1 - 1) / (K - 1) << endl;
return 0;
} | CPP |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | N,K=map(int,input().split())
c=1
while K+(c-1)*(K-1)<N:
c+=1
print(c) | PYTHON3 |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
int N, K;
cin >> N >> K;
cout << (N+K-3)/(K-1) << endl;
return 0;
} | CPP |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
int[] a = new int[n];
int p = 0;
for(int i=0; i<n; i++){
if(a[i]=='1'){
p = i;
break;
}
}
System.out.println((n-1)%(k-1)==0 ? (n-... | JAVA |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | #include <bits/stdc++.h>
using namespace std;
int main() {
long N,K;
cin>>N>>K;
long ans=1;
N=N-K;
ans+=(N+K-2)/(K-1);
cout<<ans<<endl;
} | CPP |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int K = sc.nextInt();
System.out.println((int)Math.ceil((double)(N - 1) / (K - 1)));
}
} | JAVA |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,k,ans;
cin>>n>>k;
ans=(n-1)/(k-1);
if((n-1)%(k-1)>0) ans++;
cout<<ans<<endl;
} | CPP |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
cout << (n == k ?1 : (n-1 +k-1 -1)/(k-1)) << "\n";
} | CPP |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | a, b = map(int, input().split())
c=0
while a>1 :
a-=b
c+=1
a+=1
print(c) | PYTHON3 |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | import math
N, K =map(int,input().split())
A = input()
print(math.ceil((N-1)/(K-1))) | PYTHON3 |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | from math import ceil
n,k=map(int,input().split())
print(ceil((n-1)/(k-1))) | PYTHON3 |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | n,k=map(int,input().split())
a=list(map(int,input().split()))
print((n-2)//(k-1)+1) | PYTHON3 |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int n,k; cin >>n >>k;
int ans = ((n-1)+k-2)/(k-1);
cout <<ans;
cout <<endl;
}
| CPP |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | #include <iostream>
using namespace std;
int main()
{
int N, K;
cin >> N >> K;
cout << (((N-1)%(K-1)==0) ? (N-1)/(K-1) : (N-1)/(K-1)+1) << endl;
return 0;
} | CPP |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | # C
n,k=map(int,input().split())
print((n+k-3)//(k-1)) | PYTHON3 |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | import math
n,k=map(int,input().split());input();print([math.ceil((n-k)/(k-1))+1,1][n==k]) | PYTHON3 |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
int answer = 1;
while ((K-1)*answer+1<N) {
answer++;
}
cout << answer << endl;
} | CPP |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | n, k = map(int,input().split())
a = list(map(int,input().split()))
print((n-k-1)//(k-1)+2)
| PYTHON3 |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | N, K = [int(_) for _ in input().split()]
input()
print(1 + (N - 2) // (K - 1)) | PYTHON3 |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | //车祸现场
#include<bits/stdc++.h>
using namespace std;
int main()
{
double a,b;
cin>>a>>b;
cout<<ceil((a-1)/(b-1));
} | CPP |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | import math
A,B = list(map(int,input().split()))
_ =input()
print(math.ceil((A-B)/(B-1))+1) | PYTHON3 |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
int a[] = new int[n];
int key;
for(int i=0; i<n; i++){
a[i] = sc.nextInt();
}
i... | JAVA |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | import math
n,k=map(int,input().split());print(math.ceil((n-1)/(k-1))) | PYTHON3 |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int K = sc.nextInt();
int[] S = new int[N];
for(int i = 0 ; i < N ; i++){
S[i] = sc.nextInt();
}
sc.close();
if(N==K){
System.out.println(1);
}
... | JAVA |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;cin>>n;
int k;cin>>k;
int ans=(n-1)/(k-1);
if((n-1)%(k-1)!=0)ans++;
cout<<ans<<endl;
} | CPP |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin >> n >> m;
cout << (n+m-3)/(m-1)<<endl;
} | CPP |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | import java.util.Scanner;
/*
* AtCoder Beginner Contest 101 C
*/
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
double N = scanner.nextDouble();
double K = scanner.nextDouble();
int count = (int) Math.ceil((N - 1) / (K - 1));
System.out.println(co... | JAVA |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int K = sc.nextInt();
for(int i=0;i<N;i++) {
int tmp = sc.nextInt();
}
System.out.println((int)(Math.ceil((N-1)/(K-1.0))));
}
}
| JAVA |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | import math
n, k, *nums = map(int, open(0).read().split())
print(math.ceil((n-k)/(k-1))+1) | PYTHON3 |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,k;cin>>n>>k;
cout<<(((n-1)/(k-1))+((n-1)%(k-1)?1:0))<<endl;
}
| CPP |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | #include <bits/stdc++.h>
using namespace std;
int main(){
int N, K; cin >> N >> K;
if((N-1)%(K-1) == 0) cout << (N-1)/(K-1) << endl;
else cout << (N-1)/(K-1) + 1 << endl;
} | CPP |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int c = sc.nextInt();
int [] a = new int[n];
for(int i = 0; i < n; i++)
a[i] = sc.nextInt();
System.out.println((int)Math.ceil(((double)n - 1) / ((double)c - 1)));
}
}
| JAVA |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | #include<iostream>
using namespace std;
int N,K;
int main () {
cin >> N >> K;
cout << (N - 2) / (K-1) + 1 << endl;
}
| CPP |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<n;i++)
int main(){
ll N,K,W; cin>>N>>K;
rep(i,N) cin>>W;
cout<<(N+K-3)/(K-1);
} | CPP |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | n, k = map(int, input().split())
ans = (n - 2) // (k - 1) + 1
print(ans) | PYTHON3 |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
sc.close();
int ans = 0;
int i = 0;
while (true) {
if (i + k >= n) {
... | JAVA |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | n, k = map(int, input().split())
a = map(int, input().split())
print((n-1+k-2)//(k-1)) | PYTHON3 |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | import java.util.Scanner;
public class Main {
static Scanner scan = new Scanner(System.in);
public static void main(String[] args) {
int n = scan.nextInt();
int k = scan.nextInt() - 1;
int ans = 0;
int oneIndex = 0;
for(int i = 0; i < n; i++) {
if(scan.nextInt() == 1) oneIndex = i;
}
ans = solv... | JAVA |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
double n = s.nextInt();
double k = s.nextInt();
List<Integer>l=new ArrayList<>();
for(int i=0;i<n;i++){
l.add(s.nextInt());
}
doubl... | JAVA |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | #include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
int main(){
int n,k;cin >> n >> k;
cout << (n+k-3)/(k-1) << endl;
return 0;
}
| CPP |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | #include <iostream>
using namespace std;
int main(){
int n,k;
cin >> n >> k;
n--;
k--;
cout << n/k + bool(n%k);
} | CPP |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | import java.util.*;
public class Main {
static final int INF = Integer.MAX_VALUE/2;
static final int mod = (int)1e9+7;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt(), k = sc.nextInt();
int a[] = new int[n];
for(int i=0;i<n;i++)a[i] = sc.nextInt();
sc.cl... | JAVA |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = Integer.parseInt(sc.next());
int k = Integer.parseInt(sc.next());
int ans = (n-1) / (k-1) + ((n-1) % (k-1) != 0 ? 1 : 0);
for (int i = 0; i < n; i++)
sc.next();
System.out... | JAVA |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | [print(int((n[0] - 2) / (n[1] - 1) + 1)) for n in [list(map(int, input().split()))]] | PYTHON3 |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | #include<iostream>
#include<cmath>
using namespace std;
int main(){
int n,k;cin>>n>>k;
cout<<1+ceil(double(n-k)/double(k-1));
} | CPP |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | n, k = map(int, input().split())
a = input()
print(((n-1)+(k-2))//(k-1)) | PYTHON3 |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | N,K = map(int,input().split())
A = list(map(int,input().split()))
print(-(-(N-1)//(K-1))) | PYTHON3 |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | #include <iostream>
#include <cmath>
using namespace std;
int main(){
float n,k;
cin >> n >> k;
cout << ceil((n - k) / (k - 1)) + 1 << endl;
return 0;
} | CPP |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | from math import*
n,k=map(int,input().split())
print(ceil((n-1)/(k-1))) | PYTHON3 |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | #include <iostream>
using namespace std;
int main() {
int n, k, ans = 1;
cin >> n >> k;
n -= k;
while (n > 0) {
n -= (k - 1);
ans++;
}
cout << ans << endl;
return 0;
} | CPP |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | n,k=map(int,input().split())
a=list(map(int,input().split()))
n=n-k
print(-(-n//(k-1))+1) | PYTHON3 |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | n,k=map(int,input().split())
*a,=map(int,input().split())
print((n-2)//(k-1)+1) | PYTHON3 |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | import java.util.Scanner;
import java.util.stream.IntStream;
public class Main {
public static void main(String[] args) {
try (Scanner scanner = new Scanner(System.in)) {
int n = scanner.nextInt(), k = scanner.nextInt();
IntStream.range(0, n).forEach(i -> scanner.nextInt());
// ceiling((n-1)/(k-1))
Sys... | JAVA |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | n,k=map(int,input().split());print((n-2)//(k-1)+1) | PYTHON3 |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
int n = in.nextInt();
int k = in.nextInt();
for (int ... | JAVA |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | #include <bits/stdc++.h>
using namespace std;
int main(){
int N,K,ans;
cin>>N>>K;
ans=(N+K-3)/(K-1);
cout<<ans<<endl;
}
| CPP |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | #include <iostream>
using namespace std;
int main(){
int n,k;cin>>n>>k;
cout << (n-2)/(k-1)+1 << endl;
}
| CPP |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,k;cin>>n>>k;
int a[n];
for(int i=0;i<n;i++){cin>>a[i];}
cout<<((n-1)-1)/(k-1)+1<<endl;
}
| CPP |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int X = sc.nextInt();
int Y = sc.nextInt();
int sum;
int A;
//int val = X;
//int v... | JAVA |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | import math
a, b = map(int, input().split())
d = (a-1) / (b-1)
print(math.ceil(d))
| PYTHON3 |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | import math
n,k=map(int,input().split())
print(math.ceil((n-k)/(k-1))+1) | PYTHON3 |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | #include <iostream>
using namespace std;
int main() {
int n,k;
cin >> n >> k;
cout << (n-2)/(k-1)+1;
} | CPP |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int l = sc.nextInt();
int[] A = new int[N];
for(int i=0; i<N; i++){
A[i] = sc.nextInt();
}
System.out.println((N-1+l-2)/(l-1));
}
}
| JAVA |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | #include <iostream>
using namespace std;
int main(void){
int n, k;
cin >> n >> k;
k --;
cout << (n-1 + k-1) / k << "\n";
}
| CPP |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 |
import java.util.Scanner;
/**
* Created by oka on 2018/06/23.
*/
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++) {
... | JAVA |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | #include <iostream>
using namespace std;
int main(void){
// Your code here!
int n,k;
cin>>n>>k;
if(n==k)cout<<1<<endl;
else cout<<(n-k-1)/(k-1)+2<<endl;
}
| CPP |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | #101_C
N,K=map(int,input().split())
A=list(map(int,input().split()))
print(-(-(N-1)//(K-1))) | PYTHON3 |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | #include <bits/stdc++.h>
using namespace std;
int main(void){
int N,K;
cin>>N>>K;
int res=(N-K+K-2)/(K-1)+1;
cout<<res<<endl;
} | CPP |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | #include <iostream>
#include <cmath>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
cout << 1 + ceil((N - K) / (K - 1.0)) << endl;
}
| CPP |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String str[] = br... | JAVA |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | N, K = map(int, input().split())
ans = 1 + ((N - K) + (K - 2)) // (K - 1)
print(ans)
| PYTHON3 |
p03317 AtCoder Beginner Contest 101 - Minimization | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.
On this sequence, Snuke can perform the following operation:
* Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.... | 6 | 0 | N,K = map(int,input().split())
answer = (N-2)//(K-1)+1
print(answer) | PYTHON3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.