結果

問題 No.313 π
ユーザー 👑 kmjpkmjp
提出日時 2015-12-06 00:12:59
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 30 ms / 5,000 ms
コード長 1,231 bytes
コンパイル時間 1,170 ms
コンパイル使用メモリ 149,824 KB
実行使用メモリ 16,548 KB
最終ジャッジ日時 2023-10-12 15:54:54
合計ジャッジ時間 3,458 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
16,260 KB
testcase_01 AC 30 ms
16,344 KB
testcase_02 AC 28 ms
16,340 KB
testcase_03 AC 27 ms
16,280 KB
testcase_04 AC 28 ms
16,244 KB
testcase_05 AC 28 ms
16,344 KB
testcase_06 AC 27 ms
16,280 KB
testcase_07 AC 28 ms
16,284 KB
testcase_08 AC 28 ms
16,252 KB
testcase_09 AC 29 ms
16,276 KB
testcase_10 AC 30 ms
16,344 KB
testcase_11 AC 30 ms
16,548 KB
testcase_12 AC 30 ms
16,344 KB
testcase_13 AC 30 ms
16,396 KB
testcase_14 AC 30 ms
16,288 KB
testcase_15 AC 29 ms
16,260 KB
testcase_16 AC 29 ms
16,452 KB
testcase_17 AC 29 ms
16,272 KB
testcase_18 AC 29 ms
16,340 KB
testcase_19 AC 28 ms
16,348 KB
testcase_20 AC 28 ms
16,244 KB
testcase_21 AC 28 ms
16,248 KB
testcase_22 AC 29 ms
16,260 KB
testcase_23 AC 28 ms
16,252 KB
testcase_24 AC 27 ms
16,284 KB
testcase_25 AC 27 ms
16,272 KB
testcase_26 AC 28 ms
16,248 KB
testcase_27 AC 28 ms
16,452 KB
testcase_28 AC 27 ms
16,268 KB
testcase_29 AC 28 ms
16,384 KB
testcase_30 AC 28 ms
16,284 KB
testcase_31 AC 28 ms
16,248 KB
testcase_32 AC 30 ms
16,280 KB
testcase_33 AC 29 ms
16,260 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<to;x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

string S;
ll ret=0;
ll hoge=1187919047255;

const int prime_max = 3000000;
int NP,prime[300000],divp[prime_max];
map<int,int> M;

void cprime() {
	for(int i=2;i<prime_max;i++) if(divp[i]==0) {
		prime[NP++]=i;
		for(ll j=1LL*i*i;j>i&&j<prime_max;j+=i) divp[j]=i;
	}
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cprime();
	
	cin>>S;
	S=S.substr(0,1)+S.substr(2,200000);
	for(i=1;i<=200001;i++) ret += (S[i-1]-'0')*1LL*prime[i+5];
	
	ll dif=abs(ret-hoge);
	
	for(i=1;i<=200001;i++) if(dif % prime[i+5]==0) break;
	cout<<S[i-1]<<" "<<(char)(S[i-1]+(hoge-ret)/prime[i+5])<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}
0