結果
| 問題 | No.2 素因数ゲーム |
| コンテスト | |
| ユーザー |
monaka
|
| 提出日時 | 2022-01-05 10:29:59 |
| 言語 | TypeScript (6.0.2) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 553 bytes |
| 記録 | |
| コンパイル時間 | 5,093 ms |
| コンパイル使用メモリ | 349,728 KB |
| 最終ジャッジ日時 | 2026-06-05 06:00:46 |
| 合計ジャッジ時間 | 5,793 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge3_0 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.ts(2,15): error TS7006: Parameter 'input' implicitly has an 'any' type.
main.ts(13,7): error TS7053: Element implicitly has an 'any' type because expression of type 'number' can't be used to index type '{}'.
No index signature with a parameter of type 'number' was found on type '{}'.
main.ts(17,5): error TS7053: Element implicitly has an 'any' type because expression of type 'number' can't be used to index type '{}'.
No index signature with a parameter of type 'number' was found on type '{}'.
ソースコード
function main(input) {
const n = Number(input[0]);
const obj = {};
let m = n;
for(let i=2; i*i<=n; i++) {
if(m % i === 0) {
let count = 0;
while(m % i === 0) {
m /= i;
count++;
}
obj[i] = count;
}
}
if(m !== 1) {
obj[n] = 1;
}
const values = Object.values(obj);
let tmp = Number(values[0]);
for(let i=1; i<values.length; i++) {
tmp ^= Number(values[i]);
}
console.log(tmp === 0 ? "Bob" : "Alice");
}
main(require("fs").readFileSync("/dev/stdin", "utf8").split("\n"));
monaka