結果

問題 No.1198 お菓子配り-1
ユーザー boutarou
提出日時 2020-08-28 21:33:51
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 469 bytes
コンパイル時間 581 ms
コンパイル使用メモリ 66,040 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-13 23:51:42
合計ジャッジ時間 1,246 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 11 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

int main() {
    string s;
    cin >> s;
    int n = s.size();
    if (s == "1" || s == "4") cout << -1 << endl;
    else if ((s[n - 1] - '0') % 2 == 1) cout << 1 << endl;
    else {
        if (n == 1 && (s[n - 1] - '0') % 4 == 0) {
            cout << 1 << endl;
        }
        else if ((s[n - 2] - '0') * 10 + (s[n - 1] - '0') % 4 == 0) {
            cout << 1 << endl;
        }
        else cout << -1 << endl;
    }
}
0