結果

問題 No.747 循環小数N桁目 Hard
ユーザー kazuppakazuppa
提出日時 2024-10-18 18:42:14
言語 C++23(gcc13)
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 5,460 bytes
コンパイル時間 7,120 ms
コンパイル使用メモリ 339,480 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-10-18 18:42:30
合計ジャッジ時間 11,014 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 1 ms
6,812 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 1 ms
6,940 KB
testcase_09 AC 1 ms
6,944 KB
testcase_10 AC 1 ms
6,940 KB
testcase_11 AC 1 ms
6,944 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 1 ms
6,940 KB
testcase_15 WA -
testcase_16 AC 1 ms
6,940 KB
testcase_17 AC 1 ms
6,940 KB
testcase_18 AC 1 ms
6,944 KB
testcase_19 AC 1 ms
6,940 KB
testcase_20 AC 2 ms
6,944 KB
testcase_21 AC 2 ms
6,944 KB
testcase_22 AC 1 ms
6,944 KB
testcase_23 AC 2 ms
6,940 KB
testcase_24 WA -
testcase_25 AC 2 ms
6,940 KB
testcase_26 WA -
testcase_27 AC 2 ms
6,940 KB
testcase_28 AC 2 ms
6,940 KB
testcase_29 AC 1 ms
6,940 KB
testcase_30 AC 2 ms
6,944 KB
testcase_31 AC 2 ms
6,940 KB
testcase_32 AC 2 ms
6,940 KB
testcase_33 AC 2 ms
6,940 KB
testcase_34 AC 1 ms
6,940 KB
testcase_35 AC 1 ms
6,940 KB
testcase_36 AC 2 ms
6,944 KB
testcase_37 AC 2 ms
6,940 KB
testcase_38 AC 2 ms
6,940 KB
testcase_39 AC 2 ms
6,944 KB
testcase_40 WA -
testcase_41 AC 2 ms
6,940 KB
testcase_42 AC 2 ms
6,944 KB
testcase_43 AC 2 ms
6,944 KB
testcase_44 AC 2 ms
6,940 KB
testcase_45 AC 2 ms
6,944 KB
testcase_46 WA -
testcase_47 AC 2 ms
6,940 KB
testcase_48 AC 2 ms
6,944 KB
testcase_49 AC 2 ms
6,940 KB
testcase_50 AC 2 ms
6,940 KB
testcase_51 AC 2 ms
6,940 KB
testcase_52 AC 2 ms
6,944 KB
testcase_53 AC 2 ms
6,944 KB
testcase_54 AC 2 ms
6,944 KB
testcase_55 AC 2 ms
6,940 KB
testcase_56 AC 2 ms
6,940 KB
testcase_57 AC 1 ms
6,944 KB
testcase_58 AC 3 ms
6,940 KB
testcase_59 AC 2 ms
6,940 KB
testcase_60 AC 2 ms
6,940 KB
testcase_61 AC 3 ms
6,940 KB
testcase_62 AC 3 ms
6,940 KB
testcase_63 AC 2 ms
6,940 KB
testcase_64 AC 2 ms
6,940 KB
testcase_65 AC 2 ms
6,944 KB
testcase_66 AC 2 ms
6,944 KB
testcase_67 WA -
testcase_68 AC 2 ms
6,940 KB
testcase_69 AC 2 ms
6,944 KB
testcase_70 WA -
testcase_71 AC 2 ms
6,940 KB
testcase_72 AC 2 ms
6,940 KB
testcase_73 AC 2 ms
6,940 KB
testcase_74 AC 2 ms
6,940 KB
testcase_75 AC 2 ms
6,944 KB
testcase_76 AC 2 ms
6,944 KB
testcase_77 AC 1 ms
6,944 KB
testcase_78 AC 1 ms
6,944 KB
testcase_79 AC 2 ms
6,940 KB
testcase_80 AC 2 ms
6,944 KB
testcase_81 AC 1 ms
6,940 KB
testcase_82 AC 2 ms
6,940 KB
testcase_83 AC 2 ms
6,944 KB
testcase_84 AC 2 ms
6,944 KB
testcase_85 AC 2 ms
6,944 KB
testcase_86 AC 2 ms
6,944 KB
testcase_87 WA -
testcase_88 AC 2 ms
6,940 KB
testcase_89 AC 2 ms
6,944 KB
testcase_90 AC 2 ms
6,940 KB
testcase_91 AC 2 ms
6,944 KB
testcase_92 AC 2 ms
6,940 KB
testcase_93 AC 2 ms
6,940 KB
testcase_94 AC 2 ms
6,944 KB
testcase_95 AC 2 ms
6,944 KB
testcase_96 AC 2 ms
6,940 KB
testcase_97 AC 2 ms
6,940 KB
testcase_98 AC 2 ms
6,940 KB
testcase_99 AC 2 ms
6,940 KB
testcase_100 AC 2 ms
6,940 KB
testcase_101 AC 2 ms
6,940 KB
testcase_102 AC 2 ms
6,944 KB
testcase_103 AC 3 ms
6,948 KB
testcase_104 AC 2 ms
6,940 KB
testcase_105 WA -
testcase_106 AC 2 ms
6,944 KB
testcase_107 AC 2 ms
6,940 KB
testcase_108 AC 2 ms
6,940 KB
testcase_109 AC 2 ms
6,940 KB
testcase_110 AC 2 ms
6,944 KB
testcase_111 AC 3 ms
6,940 KB
testcase_112 AC 3 ms
6,940 KB
testcase_113 AC 2 ms
6,944 KB
testcase_114 AC 2 ms
6,940 KB
testcase_115 AC 2 ms
6,944 KB
testcase_116 AC 2 ms
6,944 KB
testcase_117 AC 2 ms
6,944 KB
testcase_118 WA -
testcase_119 AC 2 ms
6,940 KB
testcase_120 AC 2 ms
6,940 KB
testcase_121 WA -
testcase_122 WA -
testcase_123 AC 3 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#include <atcoder/all>
using namespace atcoder;
using mints=modint998244353;
#pragma GCC target ("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define rep(i,a,b) for(it i=(it)(a);i<=(it)b;i++)
#define nrep(i,a,b) for(it i=(it)(a);i>=(it)b;i--)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define moda 998244353LL
#define modb 1000000007LL
#define gyaku 166374059LL
#define dai 2500000000000000000LL
#define sho -dai
#define aoi 1e+18
#define tyu 2500000000
#define giri 1000000000
#define en 3.14159265358979
#define eps 1e-14
#define endl '\n'
#define yn(x) cout<<(x?"Yes\n":"No\n");
#define YN(x) cout<<(x?"YES\n":"NO\n");
#define ci(x) cin>>x;
#define fi(x) cout<<fixed<<setprecision(x);
using it=long long;
using itn=int;
using un=unsigned long long;
using db=long double;
using st=string;
using ch=char;
using bo=bool;
using P=pair<it,it>;
using ip=pair<int,int>;
using mint=modint;
using minto=modint1000000007;
using vi=vector<it>;
using ivi=vector<int>;
using vd=vector<db>;
using vs=vector<st>;
using vc=vector<ch>;
using vb=vector<bo>;
using vp=vector<P>;
using ivp=vector<ip>;
using vm=vector<mint>;
using vms=vector<mints>;
using vmo=vector<minto>;
using sp=set<P>;
using isp=set<ip>;
using ss=set<st>;
using sc=set<ch>;
using si=set<it>;
using isi=set<int>;
using svi=set<vi>;
using vvi=vector<vi>;
using ivvi=vector<ivi>;
using vvd=vector<vd>;
using vvs=vector<vs>;
using vvb=vector<vb>;
using vvc=vector<vc>;
using vvp=vector<vp>;
using ivvp=vector<ivp>;
using vvm=vector<vm>;
using vvms=vector<vms>;
using vvmo=vector<vmo>;
using vsi=vector<si>;
using ivsi=vector<isi>;
using vsp=vector<sp>;
using ivsp=vector<isp>;
using vvsi=vector<vsi>;
using ivvsi=vector<ivsi>;
using vvsp=vector<vsp>;
using ivvsp=vector<ivsp>;
using vvvi=vector<vvi>;
using ivvvi=vector<ivvi>;
using vvvd=vector<vvd>;
using vvvb=vector<vvb>;
using vvvm=vector<vvm>;
using vvvms=vector<vvms>;
using vvvmo=vector<vvmo>;
using vvvvi=vector<vvvi>;
using ivvvvi=vector<ivvvi>;
using vvvvm=vector<vvvm>;
using vvvvms=vector<vvvms>;
using vvvvmo=vector<vvvmo>;
const it dx[4]={0,1,0,-1};
const it dy[4]={1,0,-1,0};
st abc = "abcdefghijklmnopqrstuvwxyz";
st ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

template<typename T>
void scan(vector<T> &a){
  rep(i,0,a.size()-1)cin>>a[i];
}

template<typename T>
void scan(vector<T> &a,vector<T>&b){
  rep(i,0,a.size()-1)cin>>a[i]>>b[i];
}

template<typename T>
void scan(vector<pair<T,T>> &a){
  rep(i,0,a.size()-1)cin>>a[i].first>>a[i].second;
}

template<typename T>
void dec(vector<T> &a){
  rep(i,0,a.size()-1)a[i]--;
}

it gcda(it a,it b){
  if(!a||!b){
    return max(a,b);
  }
  while(a%b&&b%a){
    if(a>b)a%=b;
    else b%=a;
  }
  return min(a,b);
}

it lcma(it a,it b){
  return a/gcda(a,b)*b;
}

bo su(ch c){return ('0'<=c&&c<='9');}

const it MOD=modb;
vi fact,fact_inv,inv;
/*  init_nCk :二項係数のための前処理
    計算量:O(n)
*/
void init_nCk(int SIZE){
  fact.resize(SIZE+5);
  fact_inv.resize(SIZE+5);
  inv.resize(SIZE+5);
  fact[0]=fact[1]=1;
  fact_inv[0]=fact_inv[1]=1;
  inv[1]=1;
  rep(i,2,SIZE+4){
    fact[i]=fact[i-1]*i%MOD;
    inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
    fact_inv[i]=fact_inv[i-1]*inv[i]%MOD;
  }
}
/*  nCk :MODでの二項係数を求める(前処理 int_nCk が必要)
    計算量:O(1)
*/
it nCk(int n, int k){
  assert(!(n<k));
  assert(!(n<0||k<0));
  return fact[n]*(fact_inv[k]*fact_inv[n-k]%MOD)%MOD;
}

struct dsu1{
  ivi par,siz;
  void init(int n){
    rep(i,0,n-1)par.emplace_back(i);
    rep(i,0,n-1)siz.emplace_back(1);
  }
  int leader(int u){
    if(par[u]==u)return u;
    return par[u]=leader(par[u]);
  }
  void merge(int u,int v){
    int ru=leader(u),rv=leader(v);
    if(ru==rv)return;
    if(ru>rv)swap(ru,rv);
    siz[ru]+=siz[rv];
    par[rv]=ru;
  }
  bool same(int u,int v){
    return leader(u)==leader(v);
  }
  int size(int u){
    return siz[leader(u)];
  }
};

struct dsu2{
  ivvi par,siz;int h,w;
  void init(int x,int y){
    h=x,w=y;par.resize(h),siz.resize(h);
    rep(i,0,h-1)
      rep(j,0,w-1)par[i].emplace_back(i*w+j);
    rep(i,0,h-1)
      rep(j,0,w-1)siz[i].emplace_back(1);
  }
  int leader(int x,int y){
    if(par[x][y]==x*par[0].size()+y)return x*w+y;
    return par[x][y]=leader(par[x][y]/w,par[x][y]%w);
  }
  void merge(int a,int b,int c,int d){
    int ru=leader(a,b),rv=leader(c,d);
    if(ru==rv)return;
    if(size(ru/w,ru%w)<size(rv/w,ru%w))swap(ru,rv);
    siz[ru/w][ru%w]+=siz[rv/w][rv%w];
    par[rv/w][rv%w]=ru;
  }
  bool same(int a,int b,int c,int d){
    return leader(a,b)==leader(c,d);
  }
  int size(int a,int b){
    int ru=leader(a,b);
    return siz[ru/w][ru%w];
  }
};

/*総和をもとめるセグ木
struct nod{
  it val;
  int siz;
  nod(int v=0,int s=0):val(v),siz(s){}
};

nod op(nod a,nod b){return nod(a.val+b.val,a.siz+b.siz);}
nod e(){return nod(0,0);}

struct act{
  int a;
  act(int e=0):a(e){}
};

nod mapping(act f,nod x){return nod(f.a+x.val,x.siz);}
act comp(act f,act g){return act(f.a+g.a);}
act id(){return act(0);}*/

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  st s,t,ans="285714";cin>>s>>t;
  mint::set_mod(6);
  mint n=0;int k=(t[t.size()-1]-'0')%5;
  if(k==0)k=5;
  for(ch c:s){
    n*=4;
    n+=c-'0';
  }
  mint now=1;
  rep(i,1,k)now*=n;
  cout<<ans[(now.val()+5)%6]<<endl;
}
0