# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
114325 |
2019-05-31T22:20:20 Z |
caoash |
Nadan (COCI18_nadan) |
Java 11 |
|
84 ms |
9868 KB |
import java.io.*;
import java.util.*;
/*
Solution Sketch:
*/
public class nadan {
static final boolean stdin = true;
static final String filename = "";
static FastScanner br;
static PrintWriter pw;
public static void main(String[] args) throws IOException {
if (stdin) {
br = new FastScanner();
pw = new PrintWriter(new OutputStreamWriter(System.out));
} else {
br = new FastScanner(filename + ".in");
pw = new PrintWriter(new FileWriter(filename + ".out"));
}
X solver = new X();
solver.solve(br, pw);
}
static class X {
public void solve(FastScanner br, PrintWriter pw) throws IOException {
int K = br.nextInt(); int N = br.nextInt();
for(int i = 1; i < N; i++){
pw.println(i);
K -= i;
}
pw.println(K);
pw.close();
}
}
//fastscanner class
public static class FastScanner {
BufferedReader br;
StringTokenizer st;
public FastScanner(String s) {
try {
br = new BufferedReader(new FileReader(s));
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public FastScanner() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String nextToken() {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(nextToken());
}
long nextLong() {
return Long.parseLong(nextToken());
}
double nextDouble() {
return Double.parseDouble(nextToken());
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
72 ms |
9568 KB |
Output is correct |
2 |
Correct |
79 ms |
9816 KB |
Output is correct |
3 |
Correct |
81 ms |
9588 KB |
Output is correct |
4 |
Correct |
77 ms |
9464 KB |
Output is correct |
5 |
Correct |
80 ms |
9844 KB |
Output is correct |
6 |
Correct |
76 ms |
9868 KB |
Output is correct |
7 |
Correct |
77 ms |
9716 KB |
Output is correct |
8 |
Correct |
77 ms |
9720 KB |
Output is correct |
9 |
Correct |
84 ms |
9592 KB |
Output is correct |
10 |
Correct |
80 ms |
9436 KB |
Output is correct |