結果
問題 |
No.3015 右に寄せろ!
|
ユーザー |
|
提出日時 | 2025-01-31 18:23:28 |
言語 | D (dmd 2.109.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 524 bytes |
コンパイル時間 | 1,550 ms |
コンパイル使用メモリ | 159,368 KB |
実行使用メモリ | 8,952 KB |
最終ジャッジ日時 | 2025-01-31 18:23:33 |
合計ジャッジ時間 | 3,636 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 WA * 29 |
ソースコード
import std; void main () { string S = readln.chomp.dup.reverse.idup; int acc = 0; const int N = S.length.to!int; long ans = 0; foreach (i; 0 .. N) { if (S[i] == '0') acc++; if (i + 1 < N && S[i] == '1' && S[i + 1] == '1') { ans += acc; } } writeln(ans); } void read (T...) (string S, ref T args) { import std.conv : to; import std.array : split; auto buf = S.split; foreach (i, ref arg; args) { arg = buf[i].to!(typeof(arg)); } }