結果

問題 No.793 うし数列 2
ユーザー hoge1e3hoge1e3
提出日時 2019-02-25 17:34:27
言語 JavaScript
(node v21.7.1)
結果
AC  
実行時間 363 ms / 2,000 ms
コード長 1,928 bytes
コンパイル時間 135 ms
コンパイル使用メモリ 6,944 KB
実行使用メモリ 46,968 KB
最終ジャッジ日時 2024-04-21 02:28:47
合計ジャッジ時間 4,670 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
39,296 KB
testcase_01 AC 65 ms
39,296 KB
testcase_02 AC 63 ms
39,296 KB
testcase_03 AC 64 ms
40,064 KB
testcase_04 AC 62 ms
39,296 KB
testcase_05 AC 87 ms
44,672 KB
testcase_06 AC 113 ms
44,672 KB
testcase_07 AC 89 ms
44,800 KB
testcase_08 AC 109 ms
45,568 KB
testcase_09 AC 96 ms
44,672 KB
testcase_10 AC 67 ms
39,296 KB
testcase_11 AC 65 ms
39,552 KB
testcase_12 AC 186 ms
44,800 KB
testcase_13 AC 319 ms
46,968 KB
testcase_14 AC 302 ms
44,928 KB
testcase_15 AC 363 ms
44,800 KB
testcase_16 AC 229 ms
44,928 KB
testcase_17 AC 302 ms
44,672 KB
testcase_18 AC 83 ms
44,928 KB
testcase_19 AC 252 ms
44,672 KB
testcase_20 AC 202 ms
44,672 KB
testcase_21 AC 263 ms
44,672 KB
testcase_22 AC 306 ms
44,672 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//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));
0