結果
問題 | No.167 N^M mod 10 |
ユーザー | wk1080id |
提出日時 | 2019-01-02 16:40:09 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,739 bytes |
コンパイル時間 | 825 ms |
コンパイル使用メモリ | 92,264 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-20 21:14:45 |
合計ジャッジ時間 | 1,651 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,820 KB |
testcase_01 | AC | 2 ms
6,820 KB |
testcase_02 | AC | 3 ms
6,816 KB |
testcase_03 | AC | 2 ms
6,816 KB |
testcase_04 | AC | 2 ms
6,816 KB |
testcase_05 | AC | 1 ms
6,816 KB |
testcase_06 | AC | 2 ms
6,820 KB |
testcase_07 | AC | 1 ms
6,816 KB |
testcase_08 | AC | 2 ms
6,816 KB |
testcase_09 | AC | 1 ms
6,820 KB |
testcase_10 | AC | 2 ms
6,816 KB |
testcase_11 | AC | 2 ms
6,820 KB |
testcase_12 | AC | 2 ms
6,816 KB |
testcase_13 | AC | 2 ms
6,820 KB |
testcase_14 | AC | 1 ms
6,816 KB |
testcase_15 | AC | 2 ms
6,816 KB |
testcase_16 | AC | 2 ms
6,816 KB |
testcase_17 | AC | 1 ms
6,816 KB |
testcase_18 | AC | 2 ms
6,820 KB |
testcase_19 | AC | 2 ms
6,816 KB |
testcase_20 | AC | 2 ms
6,816 KB |
testcase_21 | AC | 1 ms
6,816 KB |
testcase_22 | AC | 2 ms
6,816 KB |
testcase_23 | AC | 2 ms
6,820 KB |
testcase_24 | AC | 2 ms
6,820 KB |
testcase_25 | AC | 2 ms
6,820 KB |
testcase_26 | AC | 2 ms
6,816 KB |
testcase_27 | WA | - |
testcase_28 | AC | 2 ms
6,820 KB |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/iostream:39, from main.cpp:2: In member function 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]', inlined from 'int main()' at main.cpp:82:13: /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ostream:202:25: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized] 202 | { return _M_insert(__n); } | ~~~~~~~~~^~~~~ main.cpp: In function 'int main()': main.cpp:63:9: note: 'ans' was declared here 63 | int ans; | ^~~
ソースコード
#include<iostream> #include<algorithm> #include<cstdio> #include<cmath> #include<cctype> #include<math.h> #include<string> #include<string.h> #include<stack> #include<queue> #include<vector> #include<utility> #include<set> #include<map> #include<stdlib.h> #include<iomanip> using namespace std; #define ll long long #define ld long double #define EPS 0.0000000001 #define INF 1e9 #define MOD 1000000007 #define rep(i,n) for(int i=0;i<(n);i++) #define loop(i,a,n) for(int i=a;i<(n);i++) #define all(in) in.begin(),in.end() #define shosu(x) fixed<<setprecision(x) #define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! typedef vector<int> vi; typedef vector<string> vs; typedef pair<int,int> pii; int gcd(int a, int b){ if(b==0) return a; return gcd(b,a%b); } int lcm(int a, int b){ return a*b/gcd(a,b); } signed main(void) { int i,j; string s; string t; cin >> s; cin >> t; if(t == "0"){ cout << 1 << endl; return 0; } int m; if(t.size() == 1){ m = t.back() - '0'; }else{ m = (t[t.size()-2]-'0')*10 + t.back() - '0'; } m--; int ans; int v2[] = {2,4,8,6}; int v3[] = {3,9,7,1}; int v4[] = {4,6,4,6}; int v7[] = {7,9,3,1}; int v8[] = {8,4,2,6}; int v9[] = {9,1,9,1}; switch (s.back()) { case '0': ans = 0; break; case '1': ans = 1; break; case '2': ans = v2[m%4]; break; case '3': ans = v3[m%4]; break; case '4': ans = v4[m%4]; break; case '5': ans = 5; break; case '6': ans = 6; break; case '7': ans = v7[m%4]; break; case '8': ans = v8[m%4]; break; case '9': ans = v9[m%4]; break; } cout << ans << endl; }