https://atcoder.jp/contests/past201912-open/tasks/past201912_a
解説
https://atcoder.jp/contests/past201912-open/submissions/9252220
入力はエラーとなる場合があるので、整数ではなく、文字列で読み込もう。
IntParse的なやつを使って、例外が出たらerrorみたいなやつでもいい。
この程度なら、自分でパーサーを作ってしまっても良い。
自分は先頭から順に処理していっている。
string S; //--------------------------------------------------------------------------------------------------- void _main() { cin >> S; int ans = 0; fore(d, S) { if ('0' <= d and d <= '9') ans = ans * 10 + d - '0'; else { cout << "error" << endl; return; } } ans *= 2; cout << ans << endl; }