結果
| 問題 | No.634 硬貨の枚数1 |
| コンテスト | |
| ユーザー |
ikd
|
| 提出日時 | 2018-02-07 12:40:36 |
| 言語 | D (dmd 2.112.0) |
| 結果 |
AC
|
| 実行時間 | 26 ms / 2,000 ms |
| コード長 | 455 bytes |
| 記録 | |
| コンパイル時間 | 522 ms |
| コンパイル使用メモリ | 80,736 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2026-03-05 19:18:21 |
| 合計ジャッジ時間 | 2,580 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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));
}
}
ikd