結果
| 問題 | 
                            No.747 循環小数N桁目 Hard
                             | 
                    
| コンテスト | |
| ユーザー | 
                             asdf1
                         | 
                    
| 提出日時 | 2018-10-19 22:22:04 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,917 bytes | 
| コンパイル時間 | 1,294 ms | 
| コンパイル使用メモリ | 161,300 KB | 
| 実行使用メモリ | 13,636 KB | 
| 最終ジャッジ日時 | 2024-11-18 21:13:41 | 
| 合計ジャッジ時間 | 17,015 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | WA * 4 | 
| other | WA * 107 RE * 9 TLE * 4 | 
ソースコード
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9,MOD = 1e9+7,ohara = 1e6;
const ll LINF = 1e18;
using namespace std;
#define rep(i,n) for(ll (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(ll i=(a);i<(b);i++)
#define rrrep(i,a,b) for(ll i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
ll cnt=0,ans=0,a,b,c,d,cmp,cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),n,k;
bool fl;
struct edge{int to,cost;};
//-------------------------↓↓↓↓↓↓------------------------
int main(void){
       cin.tie(0);
    ios::sync_with_stdio(false);
      
    cin>>n>>k;
    ll lim=Size(n);
    while(1){
        if(lim-cnt==0)break;
        while(n[cnt]=='0'){
            cnt++;
            break;
        }
        pos=n[cnt]-'0';
        if(pos>=6){
            pos=pos%6;
            string co;
            co=to_string(pos);
            n[cnt]=co[0];
        }
        else{
            cmp=pos*10;
            pos=n[cnt+1]-'0';
            cmp=cmp+pos;
            //cout<<pos<<"\n";
            cmp=cmp%6;
            string co;
            co=to_string(cmp);
            //cout<<"co"<<" "<<co<<"\n";
            n[cnt+1]=co[0];
            cnt++;
        }
    }
    pos=n[Size(n)-1]-'0';
    pos=pos%6;
    cout<<pos<<"\n";
    if(pos%6==0){
        cout<<"4\n";
    }
    else if(pos%6==1){
        cout<<"2\n";
    }
    else if(pos%6==2){
        pos=k[Size(k)-1]-'0';
        if(pos%2==1)cout<<"8\n";
        else cout<<"7\n";
    }
    else if(pos%6==3){
        cout<<"5\n";
    }
    else if(pos%6==4){
        cout<<"7\n";
    }
    else if(pos%6==5){
        pos=k[Size(k)-1]-'0';
        if(pos%2==1)cout<<"1\n";
        else cout<<"2\n";
    }
    return 0;
}
            
            
            
        
            
asdf1