結果
問題 | No.634 硬貨の枚数1 |
ユーザー | ikd |
提出日時 | 2018-02-07 12:40:36 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 16 ms / 2,000 ms |
コード長 | 455 bytes |
コンパイル時間 | 599 ms |
コンパイル使用メモリ | 97,652 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-12 23:48:03 |
合計ジャッジ時間 | 2,774 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 75 |
ソースコード
void main(){ import std.stdio, std.string, std.conv, std.algorithm; int n; rd(n); int[] a; for(int i=1; i*(i+1)/2<=n; i++) a~=(i*(i+1)/2); if(n==a[$-1]){writeln(1); return;} foreach(e1; a)foreach(e2; a){ if(n==(e1+e2)){writeln(2); return;} } writeln(3); } void rd(T...)(ref T x){ import std.stdio, std.string, std.conv; auto l=readln.split; assert(l.length==x.length); foreach(i, ref e; x){ e=l[i].to!(typeof(e)); } }