Submission #7913258


Source Code Expand

Copy
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int p = 0;
    for(int k = 1;k<=n;k++){
      if(k*(k+1)/2>=n){
        p=k;
        break;
      }
    }
    int[] res = new int[p+1];
    for(int i = 1;i <= p;i++)res[i]=i;
    if(n!=p*(p+1)/2)res[p*(p+1)/2-n]=0;
    for(int i = 1;i <= p;i++)
      if(res[i]!=0)System.out.println(res[i]);
  }
}

Submission Info

Submission Time
Task B - Exactly N points
User patron
Language Java8 (OpenJDK 1.8.0)
Score 300
Code Size 467 Byte
Status
Exec Time 161 ms
Memory 23892 KB

Judge Result

Set Name sample dataset1 dataset2
Score / Max Score 0 / 0 200 / 200 100 / 100
Status
Test Cases sample-01.txt, sample-02.txt, sample-03.txt sample-01.txt, sample-02.txt, sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt sample-01.txt, sample-02.txt, sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 02-01.txt, 02-02.txt, 02-03.txt, 02-04.txt, 02-05.txt, 02-06.txt, 02-07.txt, 02-08.txt, sample-01.txt, sample-02.txt, sample-03.txt
Set Name Test Cases
sample sample-01.txt, sample-02.txt, sample-03.txt
dataset1 sample-01.txt, sample-02.txt, sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt
dataset2 sample-01.txt, sample-02.txt, sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 02-01.txt, 02-02.txt, 02-03.txt, 02-04.txt, 02-05.txt, 02-06.txt, 02-07.txt, 02-08.txt, sample-01.txt, sample-02.txt, sample-03.txt
Case Name Status Exec Time Memory
01-01.txt 94 ms 18896 KB
01-02.txt 93 ms 21716 KB
01-03.txt 100 ms 21840 KB
01-04.txt 93 ms 19796 KB
01-05.txt 93 ms 18640 KB
01-06.txt 93 ms 21716 KB
01-07.txt 94 ms 18644 KB
01-08.txt 93 ms 20948 KB
01-09.txt 95 ms 18644 KB
01-10.txt 94 ms 18772 KB
02-01.txt 151 ms 20052 KB
02-02.txt 158 ms 19536 KB
02-03.txt 159 ms 22484 KB
02-04.txt 161 ms 23892 KB
02-05.txt 151 ms 22356 KB
02-06.txt 138 ms 19280 KB
02-07.txt 122 ms 19284 KB
02-08.txt 149 ms 20432 KB
sample-01.txt 93 ms 19924 KB
sample-02.txt 92 ms 21716 KB
sample-03.txt 93 ms 23892 KB