結果

問題 No.747 循環小数N桁目 Hard
ユーザー alorie10
提出日時 2018-10-20 00:20:16
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 678 bytes
コンパイル時間 812 ms
コンパイル使用メモリ 57,756 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-18 23:22:55
合計ジャッジ時間 3,557 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 85 WA * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
typedef long long ll;
int main(void){
    // Your code here!
    int v[]={1,3,2,6,4,5};
    string ss,tt;
    cin>>ss>>tt;
    int p=(ss.size()-1)%6;
    int n=ss[ss.size()-1]-'0',k=tt[tt.size()-1]-'0';
    for(int i=0;i<ss.size()-1;i++){
        n+=4*(ss[i]-'0');
        //cout<<n<<v[p]<<ss[i]<<endl;
        n%=6;
        //cout<<n<<endl;
    }
    
    //p=(tt.size()-1)%6;
    for(int i=0;i<tt.size()-1;i++){
        k+=(tt[i]-'0')*4;
        k%=6;
    }
    
    
    
    
    //cout<<n<<k<<endl;
    ll ans=1;
    for(int i=0;i<k;i++){
        ans*=n;
        ans%=6;
    }
    int s[]={2,8,5,7,1,4};
    cout<<s[ans-1]<<endl;
}
0