結果

問題 No.1198 お菓子配り-1
ユーザー hiro71687khiro71687k
提出日時 2023-03-01 19:01:45
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,130 bytes
コンパイル時間 4,276 ms
コンパイル使用メモリ 252,548 KB
最終ジャッジ日時 2025-02-11 00:33:48
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 11 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll=long long;
using ld=long double;
ld pie=3.14159265359;
ll inf=80010010;
ll mod=1000000007;
int main(){
    string s;
    cin >> s;
    ll n;
    if (s.size()<18)
    {
        n=stoll(s);
    }else{
        if ((s[s.size()-1]-'0')%2)
        {
            n=5;
        }else{
            string t;
            t.push_back(s[s.size()-3]);
            if (t[t.size()-1]=='0')
            {
                t.pop_back();
            }
            t.push_back(s[s.size()-2]);
            if (t[t.size()-1]=='0')
            {
                t.pop_back();
            }
            t.push_back(s[s.size()-1]);
            ll x=stoll(t);
            if (x%4==0)
            {
                n=1;
            }else{
                n=5;
            }
        }
        
    }
    if (n%2)
    {
        if (n==1)
        {
            cout << -1 << endl;
            return 0;
        }
        cout << 1 << endl;
    }else if ((n/2)%2||n==4)
    {
        cout << -1 << endl;
    }else{
        cout << 1 << endl;
    }
    
    
}
0