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 | 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 count = 0;
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 | N,K=map(int,input().split())
A=list(map(int,input().split()))
print((N-1-1)//(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;
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 + 1];
for (int i = 1; i <= n; i++) {
a[i] = sc.nextInt();
}
int ans = 0;
for (int i = k; i < n; i += (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>
using namespace std;
int main(){
int n,k;
cin >> n >> k;
int ans=(n-1+k-2)/(k-1);//n-1/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 | 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())
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 java.util.Scanner;
public class Main{
public static void main(String []args){
int N,K;
int Ans = 0;
Scanner input = new Scanner(System.in);
N = input.nextInt();
K = input.nextInt();
Ans = (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 | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,k,a; cin>>n>> k;
while(cin>>a);
cout<<((n-1)/(k-1)+int((n-1)%(k-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 | #include <bits/stdc++.h>
using namespace std;
int main(void)
{
int n,u;
cin>>n>>u;
cout<<ceil(float(n-1)/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;
public class Main {
public static void main(String[] args) {
new Main().run();
}
void run() {
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.close();
int ans = 1, val =... | 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 < N; i++) {
a[i] = sc.nextInt();
}
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 | M, N =map(int, input().split())
A =list(map(int, input().split()))
print(-(-(M-1)//(N-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 + 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.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int k = in.nextInt();
int placeOfOne = 0;
int[] numbers = new int[n];
for(int i=0;i<n;i++) {
numbers[i] = in.nextInt();
if(numbers[i]==1) {
placeOfOn... | 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;
using ll = long long;
int main(){
ll N, K;
cin >> N >> K;
cout << (N - 1) / (K - 1) + ((N - 1) % (K - 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, 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.*;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = Integer.parseInt(scan.next());
int k = Integer.parseInt(scan.next());
int[] a =new int[n];
for (int i = 0; i < n;++i){
a[i]=Integer.parseInt(scan.next());
}
n-=k;
int 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, raw_input().split())
A_N = map(int, raw_input().split())
sum = 0
N_m_K = N - K
N_m_K_div = (N_m_K - 1) / (K - 1)
#div = N/K
#rem = N%K
if N == K:
print 1
else:
print (N_m_K_div + 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 | 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 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main{
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] tmp = br.readLine().split(" ");
int n = Integer... | 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
n,k=map(int,input().split())
ans=1
n-=k
print(ans+ceil(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 | 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 | import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
double n = Double.parseDouble(sc.next());
double k = Double.parseDouble(sc.next());
int a[] = new int[(int) n];
for (int i = 0; i < n; i++) {
a[1] = 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 | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int A = sc.nextInt();
int B = sc.nextInt();
if((A-1)%(B-1)==0) System.out.println((A-1)/(B-1));
else System.out.println(((A-1)/(B-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 | #include <iostream>
using namespace std;
int main(){
int N, K, x = 0;
cin >> N >> K;
while(N>K){
N -= (K - 1);
x++;
}
x++;
cout << x;
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,=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;
typedef long long ll;
#define inf 1000000007
int main() {
ll n,k;
cin>>n>>k;
n--;
k--;
cout << (n-1+k)/k;
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 | #include<stdio.h>
int a[(int)1e5+1],n,k;
int main(){
scanf("%d%d",&n,&k);
for(int i=1;i<=n;++i)scanf("%d",&a[i]);
int ans=(n-1+k-2)/(k-1);
printf("%d\n",ans);
} | 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 | public class Main {
private static java.util.Scanner scanner = new java.util.Scanner(System.in);
public static void main(String[] args) {
System.out.println((int)Math.ceil((scanner.nextInt() - 1) / (scanner.nextInt() - 1F)));
}
} | 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) {
try(Scanner sc = new Scanner(System.in)){
int n=sc.nextInt();
int k=sc.nextInt();
int[] a=new int[n+1];
for(int i=0; i<n; i++) {
a[i]=sc.nextInt();
}
n--;
k--;
if(n%k>0) {
System.out.println(n/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;
/**
*
* @author cs18097
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner sc = new Scanner(System.in);
int number = sc.nextInt();
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 | N, K = [int(s) for s in 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 | M, N =map(int, input().split())
print(-(-(M-1)//(N-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;
int min_idx=0;
int temp;
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 | N,K=map(int,input().split())
print((N+K-3)//~-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 | 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();
if((N-1) % (K-1) == 0)
System.out.println((N-1)/(K-1));
else
System.out.println((N-1)/(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 | 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 | n,k=map(int,input().split())
print(0--~-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 | import java.util.*;
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 c=0;c<n;c++){
a[c]=sc.nextInt();
}
int count=0;
count+=(n-1)/(k-1);
if((n-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);
String[] arr = sc.nextLine().split(" ");
int n = Integer.parseInt(arr[0]);
int k = Integer.parseInt(arr[1]);
int[] seq = new int[n];
arr = sc.nextLine().split(" ");
for(int i=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 | import java.util.Arrays;
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 < N; i++) {
A[i] = sc.nextInt();
}
Arrays.sort(A);
int x =... | 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<cstdio>
int main(){
unsigned N, K;
scanf("%u %u", &N, &K);
printf("%u\n", (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 <iostream>
using namespace std;
int main() {
int n, k;
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 | import java.util.Scanner;
public class Main {
static int N, K;
static int[] A;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
N = sc.nextInt();
K = sc.nextInt();
A = new int[N];
for (int i = 0; i < N; i++) {
A[i] = sc.nextInt();
}
System.out.println((N - 2) / (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.*;
public 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<b;i++)
{
c[i]=sc.nextInt();
}
System.out.println((int) Math.ceil((double) (a - b) / (b - 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 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
N--, K--;
cout << (N + 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 | n, k = input().split(" ")
n = int(n)
k = int(k)
a = 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.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int N=sc.nextInt();
int K=sc.nextInt();
int indexone=0;
for(int i=0;i<N;i++){
if(sc.nextInt()==1){
indexone=i;
bre... | 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=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.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.*;
public class Main {
int[] inputArray;
public static void main(String[] args) throws IOException {
new Main().run();
}
void run() {
... | 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.Math.*;
import java.math.BigInteger;
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()... | 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 <math.h>
using namespace std;
int main(){
double n,k;
cin >> n >> k ;
int ans;
ans=ceil((n-1)/(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 | N, K = map(int, input().split())
s = input()
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 <iostream>
#include <cmath>
using namespace std;
int main() {
long 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, raw_input().split())
nums = map(int, raw_input().split())
n -= 1
k -= 1
if n % k == 0:
print(n // k)
else:
print(n // 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 | #include<bits/stdc++.h>
using namespace std;
int main(){
double n,k;
cin>>n>>k;
for(int i = 0; i < n; i++){
int t;cin>>t;
}
cout<<ceil((n-1)/(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())
N -= K
ans = 1
while N > 0:
N -= K - 1
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 = list(map(int,input().split()))
a = (N-1)/(K-1)
print(int(a) + (0 if int(a)==a else 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, *A = map(int, open(0).read().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() {
int N,K,ans;
cin>>N>>K;
ans=(N-2)/(K-1)+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.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
int ans = (int)(Math.ceil((n-1.0)/(k-1.0)));
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 | import java.util.*;
class Main{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int M = sc.nextInt();
int arr[] = new int[N];
int one = -1;
for(int n=0;n<N;n++){
arr[n] = sc.nextInt();
if(arr[n] == 1) one = n;
one = Math.min(one,N-one-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.*;
public class Main {
public static void main(String[] args) {
// 自分の得意な言語で
// Let's チャレンジ!!
Scanner sc = new Scanner(System.in);
String line = sc.nextLine();
String s[]=line.split(" ",0);
int n=Integer.parseInt(s[0]);
int k=Integer.parseI... | 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 ans = (n - 1) / (k - 1);
if((n - 1) % (k - 1) != 0) {
ans++;
}
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())
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())
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 | #include <bits/stdc++.h>
using namespace std;
int main() {
int N,K;
cin>>N>>K;
for(int i=1;i>0;i++){
if(1+i*(K-1)>=N){cout<<i<<endl;break;}
}
} | 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();
}
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 | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// write your code here
Scanner scanner = new Scanner(System.in);
int N = scanner.nextInt(), K = scanner.nextInt();
int res = 1;
int cur = K - 1;
while (cur < N - 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(void) {
double N,K; cin>>N>>K;
cout<<ceil((N-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 | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO 自動生成されたメソッド・スタブ
Scanner sc1 = new Scanner(System.in);
int n = sc1.nextInt();
int k = sc1.nextInt();
int ans = (n-1)/(k-1);
if((n-1)%(k-1) != 0) {
ans++;
}
System.out.println(ans);
sc1.close();
}
... | 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) {
int[] a;
a=new int[100000];
int k,n,x,t;
Scanner sc=new Scanner(System.in);
n=sc.nextInt();
k=sc.nextInt();
for(int i=0;i<n;i++) {
a[i]=sc.nextInt();
}
x=(n-1)/(k-1);
t=(n-1)%(k-1);
if(t>0)
x++;
System.out.println(x)... | 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=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 | 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 | #include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
double n,k;
cin>>n>>k;
cout<<ceil((n-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 | 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 ans = (N-1) / (K-1);
ans += (N-1) % (K-1) == 0 ? 0 : 1;
System.out.println(ans);
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 | #include <bits/stdc++.h>
using namespace std;
int main(){
int N,K; cin >> N >> K;
cout <<(((N-K)+(K-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 | n,k = map(int,input().split())
A = 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 |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;
public final class Main {
public static void main(String[] args) {
final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
final String[] line = in.nextLine().split(" ");
... | 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 < n; i++) {
a[i] = sc.nextInt();
}
n = n - k;
int count = 1;
if(n <= 0) {
Syst... | 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 ans = (n - 1) / (k - 1);
if ((n - 1) % (k - 1) != 0) {
ans++;
}
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 | import math
n,k = [int (x) for x 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 | #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);
else cout<<(N-1)/(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 | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,k;
cin>>n>>k;
n--;
k--;
cout<<(n%k==0?n/k: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 | import math
N,K = map(int,input().rstrip().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(final String[] args) {
final Scanner scanner = new Scanner(System.in);
final int n = scanner.nextInt();
final int k = scanner.nextInt();
if (k >= n) {
System.out.println(1);
} else {
... | 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*
n,k=map(int,input().split())
print(ceil(~-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())
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 n, k;
int main(){
cin >> n >> k;
int one;
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 <iostream>
int main(){
int n, k;
std::cin >> n >> k;
std::cout << (n+k-3)/(k-1) << std::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;
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,cnt;
cin >> n >> k;
cnt = (n-1) / (k - 1);
if ((n-1) % (k - 1) != 0)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 | import java.util.Scanner;
class Main{
public static void main(String[] args) {
Scanner stdIn=new Scanner(System.in);
int n=stdIn.nextInt(),k=stdIn.nextInt(),a,i;
for(i=0;i<n;i++) a=stdIn.nextInt();
System.out.print((n-2)/(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 | 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;
int ans = 0;
sc.close();
if(N==K){
ans = 1;
}else{
ans = (int)(N-1)/(K-1);
if((N-1)%(K-1)>0)
ans++;
}
Syste... | 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+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 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 A = 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 | 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 c = 1;
for (int i = K; i < N; i += K - 1) {
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 sys
def main():
N, K = map(int, raw_input().split(' '))
A = map(int, raw_input().split(' '))
position_1 = A.index(1)
if position_1 <= K or N-K <= position_1:
if (N-K) % (K-1) > 0:
print 1 + (N-K)/(K-1) + 1
return
else:
print 1 + (N-K)/(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 | N,K=map(int,input().split())
A=input()
import math
print(math.ceil((N-1)/(K-1))) | PYTHON3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.