CODE FESTIVAL 2016 Final

Submission #7913258

Source codeソースコード

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

Task問題 B - Exactly N points
User nameユーザ名 patron
Created time投稿日時
Language言語 Java8 (OpenJDK 1.8.0)
Status状態 AC
Score得点 300
Source lengthソースコード長 467 Byte
File nameファイル名
Exec time実行時間 161 ms
Memory usageメモリ使用量 23892 KB

Test case

Set

Set name Score得点 / Max score Cases
sample - sample-01.txt,sample-02.txt,sample-03.txt
dataset1 200 / 200 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 100 / 100 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

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
01-01.txt AC 94 ms 18896 KB
01-02.txt AC 93 ms 21716 KB
01-03.txt AC 100 ms 21840 KB
01-04.txt AC 93 ms 19796 KB
01-05.txt AC 93 ms 18640 KB
01-06.txt AC 93 ms 21716 KB
01-07.txt AC 94 ms 18644 KB
01-08.txt AC 93 ms 20948 KB
01-09.txt AC 95 ms 18644 KB
01-10.txt AC 94 ms 18772 KB
02-01.txt AC 151 ms 20052 KB
02-02.txt AC 158 ms 19536 KB
02-03.txt AC 159 ms 22484 KB
02-04.txt AC 161 ms 23892 KB
02-05.txt AC 151 ms 22356 KB
02-06.txt AC 138 ms 19280 KB
02-07.txt AC 122 ms 19284 KB
02-08.txt AC 149 ms 20432 KB
sample-01.txt AC 93 ms 19924 KB
sample-02.txt AC 92 ms 21716 KB
sample-03.txt AC 93 ms 23892 KB