結果
| 問題 |
No.791 うし数列
|
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2019-05-05 06:42:29 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 540 bytes |
| コンパイル時間 | 782 ms |
| コンパイル使用メモリ | 103,764 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-22 01:12:56 |
| 合計ジャッジ時間 | 1,379 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 15 |
ソースコード
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;
int calc(string s) {
if (s.front != '1') return -1;
if (s.length == 1) return -1;
if (s[1..$].any!(e => e != '3')) return -1;
return cast(int)s.length - 1;
}
void main() {
string s = read!string;
writeln(calc(s));
}
norioc