結果

問題 No.1198 お菓子配り-1
ユーザー w2w2w2w2
提出日時 2020-08-28 21:42:06
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,361 bytes
コンパイル時間 1,345 ms
コンパイル使用メモリ 166,988 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-28 01:24:40
合計ジャッジ時間 1,917 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 1 ms
6,944 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 1 ms
6,944 KB
testcase_08 AC 1 ms
6,940 KB
testcase_09 AC 1 ms
6,940 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 1 ms
6,944 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 1 ms
6,944 KB
testcase_14 AC 1 ms
6,940 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 2 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using P = pair<ll,ll>;
constexpr ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template<class T> inline void chmin(T& a, T b){
    if (a > b){
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b){
    if (a < b){
        a = b;
    }
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(12);
    string N;
    cin >> N;
    if(N.size() == 1){
        if(N[0] == '3' || N[0] == '5' || N[0] == '7' || N[0] == '9' || N[0] == '8'){
            cout << 1 << "\n";
        }else{
            cout << -1 << "\n";
        }
    }else{
        if(N[N.size()-1] == '3' || N[N.size()-1] == '5' || N[N.size()-1] == '7' || N[N.size()-1] == '9' || N[N.size()-1] == '1'){
            cout << 1 << "\n";
        }else if(((N[N.size()-2] - 0)*10 + (N[N.size()-1]  - '0') )% 4 == 0){
            cout << 1 << "\n";
        }else{
            cout << -1 << "\n";
        }
    }
}
0