結果

問題 No.747 循環小数N桁目 Hard
ユーザー karinohitokarinohito
提出日時 2021-08-04 16:29:05
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 786 bytes
コンパイル時間 2,336 ms
コンパイル使用メモリ 167,548 KB
実行使用メモリ 4,480 KB
最終ジャッジ日時 2023-10-14 21:22:56
合計ジャッジ時間 6,882 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

//#include <atcoder/all>
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
//using namespace atcoder;
using ll = long long;
#define all(A) A.begin(),A.end()
using vll = vector<ll>;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
using Graph = vector<vector<ll>>;

int main() {
	string S="285714";
	


	string N;
	cin>>N;
	bool T=((N[N.size()-1]-'0')%2==0);
	ll Th=0;
	rep(i,N.size()){
		Th+=N[i]-'0';
		Th%=3;
	}
	string K;
	cin>>K;
	K="0"+K;
	ll f=(K[K.size()-2]-'0')*10+K[K.size()-1]-'0';

	f%=4;
	ll s=0;
	if(T){
		if(Th==0){
			s=0;
		}
		else if(Th==1){
			s=4;
		}
		else{
			s=2;
		}
	}
	else{
		if(Th==0){
			s=3;
		}
		else if(Th==1){
			s=1;
		}
		else{
			s=5;
		}
	}
	//cout<<s<<endl;
	ll num=pow(s,f);
	num+=5;
	num%=6;
	cout<<S[num]<<endl;
}
0