結果
問題 | No.747 循環小数N桁目 Hard |
ユーザー |
![]() |
提出日時 | 2018-10-19 21:52:06 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 722 bytes |
コンパイル時間 | 1,544 ms |
コンパイル使用メモリ | 166,808 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-18 20:25:31 |
合計ジャッジ時間 | 4,629 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 100 WA * 20 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)#define rep(i,n) REP(i,0,n)#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)#define ALLOF(c) (c).begin(), (c).end()typedef long long ll;typedef unsigned long long ull;int calc_mod6(const string& str){int ret = 0;int now = 0;rep(i,str.size()){now = now * 10 + (str[i]-'0');if(now>=6){now = now%6;}}return now;}int main(){string N, K;cin >> N;cin >> K;int x = calc_mod6(N);int y = calc_mod6(K);int ret = 1;rep(i,y){ret *= x;ret %= 6;}string str = "285714";cout << str[(ret+5)%6] << endl;return 0;}