結果

問題 No.1198 お菓子配り-1
ユーザー iomir
提出日時 2023-03-28 15:45:01
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 430 bytes
コンパイル時間 1,369 ms
コンパイル使用メモリ 167,516 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-20 05:29:47
合計ジャッジ時間 2,260 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

#define all(v) v.begin(),v.end()
using ll = long long;


int main(){
    string S;
    cin>>S;
    if((S[S.size()-1]-'0')%2==1){
        if(S.size()==1&&S[0]=='1') cout << -1 << endl;
        else cout << 1 << endl;
        return 0;
    }
    ll a=0;
    for(int i=0;i<S.size();i++){
        a*=10;
        a+=S[i]-'0';
        a%=4;
    }
    cout << (a||S=="4"?-1:1) << endl;
    }
0