結果

問題 No.313 π
ユーザー konjo_pkonjo_p
提出日時 2015-12-07 00:56:17
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 608 bytes
コンパイル時間 429 ms
コンパイル使用メモリ 60,040 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-12 18:44:11
合計ジャッジ時間 3,385 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
4,352 KB
testcase_01 AC 34 ms
4,348 KB
testcase_02 AC 9 ms
4,348 KB
testcase_03 AC 9 ms
4,352 KB
testcase_04 AC 9 ms
4,348 KB
testcase_05 AC 9 ms
4,348 KB
testcase_06 AC 9 ms
4,348 KB
testcase_07 AC 9 ms
4,348 KB
testcase_08 AC 9 ms
4,352 KB
testcase_09 AC 9 ms
4,352 KB
testcase_10 AC 35 ms
4,352 KB
testcase_11 AC 34 ms
4,348 KB
testcase_12 AC 34 ms
4,352 KB
testcase_13 AC 34 ms
4,348 KB
testcase_14 AC 34 ms
4,352 KB
testcase_15 AC 34 ms
4,352 KB
testcase_16 AC 34 ms
4,348 KB
testcase_17 AC 35 ms
4,348 KB
testcase_18 AC 33 ms
4,348 KB
testcase_19 AC 23 ms
4,352 KB
testcase_20 AC 10 ms
4,348 KB
testcase_21 AC 23 ms
4,352 KB
testcase_22 AC 31 ms
4,352 KB
testcase_23 AC 25 ms
4,348 KB
testcase_24 AC 15 ms
4,348 KB
testcase_25 AC 14 ms
4,348 KB
testcase_26 AC 28 ms
4,348 KB
testcase_27 AC 28 ms
4,352 KB
testcase_28 AC 12 ms
4,348 KB
testcase_29 AC 22 ms
4,348 KB
testcase_30 AC 16 ms
4,348 KB
testcase_31 WA -
testcase_32 AC 31 ms
4,348 KB
testcase_33 AC 21 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

typedef long long ll;
const ll correct = 2122389473;

ll p = (1LL << 31) -1;
ll b = (1LL << 19) -1;

int main() {
	string s;
	ll hash = 0;
	cin >> s;
	for(int i = s.size()-1; i >= 0; i--) {
		if(s[i] != '.')
			hash = (hash * b + s[i]-'0') % p;
	}
	ll a = 1;
	for(int i = 0; i < s.size(); i++) {
		if(s[i] != '.') {
			ll tmp = (hash - (s[i]-'0') * a + p) % p;
			for(int j = 0; j < 10; j++) {
				if(correct == (tmp + j * a) % p) {
					cout << s[i] << " " << j << endl;
					return 0;
				}
			}
			a = (a * b) % p;
		}
	}
}
0