結果
問題 |
No.1624 三角形の反射
|
ユーザー |
|
提出日時 | 2021-07-23 23:48:37 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 592 bytes |
コンパイル時間 | 4,037 ms |
コンパイル使用メモリ | 254,588 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-22 11:56:20 |
合計ジャッジ時間 | 4,545 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
import std; void main(){ auto a = readln.chomp.split(".").join.to!long; ulong x = 0; ulong y = 0; ulong result = 0; auto d = 0; while(true){ d += a; if(d > 1000 && (x + y) % 2 == 1){ d -= 1000; y += 1; result += 1; } while(d > 1000){ d -= 1000; y += 1; result += 2; } if(d == 1000){ char c = 'A'; if((x + y) % 2 == 0){ result += 1; }else{ if(x % 2 == 0){ c = 'B'; }else{ c = 'C'; } } writefln("%c %d", c, result); break; } if((x + y) % 2 == 0 || d - a > 0){ result += 1; } result += 1; x += 1; } }