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 | #include <bits/stdc++.h>
using namespace std;
int main () {
int n,k;
cin >> n >> k;
cout << ((n-1)+(k-2))/(k-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<iostream>
using namespace std;
int main(){
int n, k;
cin >> n >> k;
cout << ((n-1)+(k-2))/ (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 | #include<stdio.h>
int main()
{
int n,k,sum=0;
scanf("%d%d",&n,&k);
while(1)
{
n-=k;
sum++;
if(n<=0)break;
n++;
}
printf("%d\n",sum);
} | 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,*a=map(int,open(0).read().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 | 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 | import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
for(int i = 1;;i++){
n = n-k;
if(n <= 0){
System.out.pr... | 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 << 1 + (n - 2) / (k - 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 | print(eval('0--~-'+input().replace(' ','//~-'))) | 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())
x=(n-k)//(k-1)
y=(n-k)%(k-1)
print(x+1) if y==0 else print(x+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 | 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];
for (int i = 0; i < N; i++) {
A[i] = sc.nextInt();
}
int n = N - 1;
int k = K - 1;
int ans = 0;
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(){
int n,k;
cin >> n >> k;
int a[n];
for(int i=0;i<n;i++){
cin >> a[i];
}
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 | 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();
n -= k;
k -= 1;
int count = 1;
while(n > 0){
n -= k;
count++;
}
System.out.println(count);
... | 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(-((1-N)//(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_arr = 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 | def main():
n, k = map(int,input().split())
print((n - 2) // (k - 1) + 1)
main() | 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;
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())
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 | n,k=map(int,input().split())
i=1
cnt=0
while i<n:
i+=k-1
cnt+=1
print(cnt) | 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;
} | 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);
String inputLine = sc.nextLine();
String[] tokens = inputLine.split(" ");
int N = Integer.parseInt(tokens[0]);
int K = Integer.parseInt(tokens[1]);
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 n, k;
int main(){
cin >> n >> k;
cout << (n+k-3) / (k-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 | n,k = map(int,input().split())
import math
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 | # -*- coding: utf-8 -*-
import math
# スペース区切りの整数の入力
n,k = map(int, raw_input().split())
ll = map(int, raw_input().split())
if n<= k:
print 1
else:
print int(math.ceil(float(n-k)/float(k-1))+1) | PYTHON |
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))+((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 | n,k=map(int,input().split())
input()
if n==k:
print(1)
else:
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 | ## n-1 + k-1 -1 = n+k-3が正しい
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 | n, k = map(int, input().split())
s = 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 | import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int K = sc.nextInt();
int ans = (int)Math.ceil((double)(N-1) / (K-1));
System.out.println(... | 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 - 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 = input()
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 | n,k=[int(i)-1 for i in input().split()];print(-(-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 | N, K = map(int,input().split())
A = 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 | n, k = list(map(int, input().split()))
import math
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 | n,k = map(int,input().split())
a=input()
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 | n, k = map(int, input().split())
print((n-1)//(k-1)+1 if (n-1)%(k-1) else (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 *
N, K = [int(x) for x in input().strip().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<bits/stdc++.h>
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 | N,K = map(int,input().split())
A = list(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 {
public static void main(String[] args){
Scanner in = new java.util.Scanner(System.in);
int N = in.nextInt();
int K = in.nextInt();
int d = (N-1)/(K-1);
int e = (N-1)%(K-1);
if(e == 0) {
System.out.print(d);
}else {
System.out.print(d+1);
}
in.c... | 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; //切り上げ
} | 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--;
int t=n/k;
if(n%k!=0)
t++;
cout<<t;
} | 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;
/*
1回の操作でk-1個を最小値に変換
*/
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];
for(int i = 0; i < N; i++) {
arr[i] = sc.nextI... | 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())
aa=input()
a = n - k
num = -(-a // (k-1))
print(num+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;
n--;k--;
cout<<((n-1)/k+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.*;
public class Main {
public static void main(String[] args) {
// write your code here
Scanner sc = new Scanner(System.in);
double n = sc.nextInt() - 1;
int k = sc.nextInt() - 1;
System.out.println((int)Math.ceil(n / k));
}
} | 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.lang.*;
import java.io.*;
import java.util.*;
class Main{
public static void main(String args[]) throws FileNotFoundException{
Scanner sc=new Scanner(System.in);
String buf=sc.nextLine();
String[] sbuf=buf.split(" ");
int n=Integer.parseInt(sbuf[0]);
int k=Integer.parseInt(sbuf[1]);
sbuf=sc... | 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-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 | 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];
for(int i = 0; i < N; i++){
A[i] = sc.nextInt();
}
sc.c... | 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;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c[] = new int[a];;
for (int i = 0; i < a; i++) {
c[i] = sc.nextInt();
}
int count = 0;
a -= b;
count++;
while (a > 0) {
a = a... | 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.*;
import static java.lang.Integer.*;
//import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;
public class Main {
public static void main(String[] args) {
int i,j;
Scanner sc = new Scanner(in);
int n = parseInt(sc.next());
int k = parseInt(sc.next()... | 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()
{
int n, k;
cin >> n >> k;
int res = 1 + (n - 2) / (k - 1);
cout << res << "\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.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws Exception {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String s[] = (new String(in.readLine())).split(" ");
int N = Integer.parseInt(s[0]);
int K = Integer.parseInt(s... | 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.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
double N = sc.nextDouble();
double K = sc.nextDouble();
System.out.println((int)(Math.ceil((N-K)/(K-1)))+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 | #abc101c
n,k=map(int,raw_input().split())
if n==k:
print 1
elif (n-1)%(k-1)==0:
print (n-1)/(k-1)
else:
print (n-1)/(k-1)+1
| PYTHON |
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,m=map(int,input().split())
print(math.ceil((n-1)/(m-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())
input()
print(((N - 1) + (K - 1) - 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(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 | import java.util.Scanner;
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];
for (int i = 0; i < N; i++) {
A[i] = Intege... | 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(){
int n , k;
cin >> n >> k;
for(int i=0;i<n;i++){
int tmp;
cin >> tmp;
}
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 | 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];
for(int i=0; i<n; ++i){
a[i] = sc.nextInt();
}
int count = 0;
count += (n-1) / (k-1);
if((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 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++){
sc.nextInt();
}
int replaceCount = k;
int controllCount = 1;
while (replaceCount < n){
replaceCou... | 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.ArrayList;
import java.util.Scanner;
class Main {
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
ArrayList<Integer> a = new ArrayList<>();
for(int i = 0; i < n ; i++){
a.... | 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 seer = new Scanner(System.in);
int n = seer.nextInt();
int k = seer.nextInt();
for(int i = 0; i < n; i++){
seer.nextInt();
}
System.out.println((int)Math.ceil((n-1)*1.0/(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 <iostream>
int main(){int n,k;std::cin>>n>>k;std::cout<<(n-k+(k-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= [int(x) for x in input().split()]
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 | N, K = map(int, raw_input().split())
print (N+K-3)/(K-1) | PYTHON |
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();
}
int sum = k;
int cnt = 1;
for (int i = 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 | #include<iostream>
#include<cmath>
#include<string.h>
using namespace std;
int main(){
int N,K,ans;
cin >> N >> K;
ans = (N+K-3)/(K-1);
cout << ans << "\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 math
N, K = map(int, input().split())
A = input()
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 | 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];
for(int i = 0;i < n;i++)a[i]=sc.nextInt();
if((n-1)%(k-1)==0)System.out.println((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;
cin >> N >> K;
int Sum=K, cnt=1;
while(Sum < N){Sum += K-1;cnt++;}
cout<<cnt<<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 <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
cout << (N - 2) / (K - 1) + 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 | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin>>n>>m;
int ans=(n-1)/(m-1);
if((n-1)%(m-1))ans++;
cout<<ans;
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 math
N,K = [int(i) for i in 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 | N,K = map(int, input().split())
A = list(map(int, input().split()))
print((N-1+K-1-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() {
double n, k; cin >> n >> k;
cout << ceil((n-1)/(k-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<stdio.h>
int main (void)
{
int ans,n,k;
scanf("%d%d",&n,&k);
ans=(n-1)/(k-1);
if((n-1)%(k-1)!=0)
ans++;
printf("%d\n",ans);
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;
/*
* AtCoder Beginner Contest 101 C
*/
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int N = scanner.nextInt();
int K = scanner.nextInt();
int[] A = new int[N];
int minNumIndex = 0;
for (int i = 0; i < N; i++) {
A[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.Scanner;
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];
for (int i = 0; i < n; i++) {
int tmp = In... | 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) {
// TODO 自動生成されたメソッド・スタブ
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int K = sc.nextInt();
int N_ = N - K;
int K_ = K - 1;
int X = N_ / K_;
String ZZ = sc.nextLine();
if(N_ % K_ == 0) {
System.ou... | 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 - 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())
_ = input()
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())
input()
print(-1*((-1*(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;
scanf("%d %d", &n, &k);
printf("%d\n", (n + k - 3) / (k - 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 | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,k;
cin>>n>>k;
for(int i=0;i<n;i++){
int a;
cin>>a;
}
cout<<(n+k-3)/(k-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 math
n,k = map(int,input().split())
print(int(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 | N, K = map(int, raw_input().split())
c = 1
s = N-K
while(s>0):
c += 1
s -= K-1
print c | PYTHON |
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-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 | #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);
}
| 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,raw_input().split())
arr = map(int,raw_input().split())
print (n-1)/(k-1) + (0 if (n-1)%(k-1) == 0 else 1) | PYTHON |
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 n, k;
cin >> n >> k;
vector<int> a(n,0);
cout << ceil((n-1.)/(k-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<iostream>
using namespace std;
int main()
{
int N,K;
cin >> N >> K;
int i = 0;
while (i*K - (i - 1) < N) {
++i;
}
cout << i << 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<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;
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.List;
import java.util.ArrayList;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int S = sc.nextInt();
List<Integer> list1 = new ArrayList<>();
int count = 0;
for(int i = 0; i < N; i++){
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 | // C - Minimization
#include <bits/stdc++.h>
using namespace std;
int main(){
int N,K; cin>>N>>K;
cout<< (N-1+(K-1)-1)/(K-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 {
static int N;
static int K;
static List<Integer> A = new ArrayList<>();
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
N = sc.nextInt();
K = sc.nextI... | 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;
/**
*
* @author psygn
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int N = scanner.nextInt();
int K = scanner.nextInt();
String s... | 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-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.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt(), k=sc.nextInt();
int[] arr = new int[n];
for (int i=0; i<n; i++) arr[i] = sc.nextInt();
int ans = 0;
n = n - k;
while (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 | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.