結果
問題 | No.793 うし数列 2 |
ユーザー | hoge1e3 |
提出日時 | 2019-02-25 17:34:27 |
言語 | JavaScript (node v21.7.1) |
結果 |
AC
|
実行時間 | 397 ms / 2,000 ms |
コード長 | 1,928 bytes |
コンパイル時間 | 143 ms |
コンパイル使用メモリ | 6,820 KB |
実行使用メモリ | 45,568 KB |
最終ジャッジ日時 | 2024-10-13 00:59:34 |
合計ジャッジ時間 | 5,003 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 74 ms
39,936 KB |
testcase_01 | AC | 77 ms
39,680 KB |
testcase_02 | AC | 70 ms
39,936 KB |
testcase_03 | AC | 71 ms
39,680 KB |
testcase_04 | AC | 70 ms
39,808 KB |
testcase_05 | AC | 91 ms
45,056 KB |
testcase_06 | AC | 117 ms
45,184 KB |
testcase_07 | AC | 95 ms
45,568 KB |
testcase_08 | AC | 116 ms
45,056 KB |
testcase_09 | AC | 103 ms
45,312 KB |
testcase_10 | AC | 68 ms
39,680 KB |
testcase_11 | AC | 69 ms
39,552 KB |
testcase_12 | AC | 199 ms
45,440 KB |
testcase_13 | AC | 349 ms
45,184 KB |
testcase_14 | AC | 324 ms
45,312 KB |
testcase_15 | AC | 397 ms
45,056 KB |
testcase_16 | AC | 245 ms
45,440 KB |
testcase_17 | AC | 330 ms
45,440 KB |
testcase_18 | AC | 93 ms
45,312 KB |
testcase_19 | AC | 280 ms
45,184 KB |
testcase_20 | AC | 233 ms
45,184 KB |
testcase_21 | AC | 293 ms
45,312 KB |
testcase_22 | AC | 333 ms
45,312 KB |
ソースコード
//133333333333333333 var fs = require('fs'); var length = fs.fstatSync(process.stdin.fd).size; var buffer = Buffer.alloc(length); var bytesRead = fs.readSync(process.stdin.fd, buffer, 0, length, 0); var input = buffer.toString('utf8', 0, bytesRead); //var input="133333333333333333";//"1000000006"; //var input="1000000000000000000"; var m=1000000007n; // u1 = um var n=BigInt(input); n=(n-1n)%(m-1n)+1n; n=(n+"").replace("n","")-0; m=(m+"").replace("n","")-0; const PITCH=10000000; var cache=[693786035,590628878,237899936,859545643,926415565,233422050,794894811,851187198,143283872,263119286,405325043,650312175,21449757,496238477,519220205,901183890,3023425,695342322,725638401,516955262,41264170,202362364,601547206,819822969,690626643,64828682,132815103,496752609,718786042,804446123,979931491,633545932,638714794,825511696,683473922,132554980,719048317,352803603,620916882,787569727,137735182,556034422,509340893,408942294,809708437,935818482,78671884,256316801,106178901,857333339,718639552,267742706,562095437,662473792,508406921,864099917,686538443,27482146,410190052,612070218,862928014,738683026,965311890,924837101,28814113,983432156,489330313,759637996,56607695,179816379,24292069,766130976,171731787,280513512,662642711,240268506,443200521,800836586,719614552,302528889,926353408,989699794,255694620,241507823,559649863,854200784,44614285,942980536,839712422,674545768,740195603,59777299,412823995,755924396,204523626,639397519,126254662,257077018,557227158,190476001]; //var chk=263119286; var i,b; if (n>=PITCH) { b=cache[Math.floor(n/PITCH)-1]; i=Math.floor(n/PITCH)*PITCH; } else { b=13; i=1; } for (; i<n;i++) { /*if (i%PITCH==0) { cache.push(b); console.log(i,b); }*/ b=(b*10+3)%m; /*if (b===chk) { console.log(n); break; }*/ //console.log((s=>s.substring(s.length-9))("00000000"+b)); } console.log(b); //console.log(JSON.stringify(cache));