結果
| 問題 |
No.648 お や す み
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-09-20 21:26:10 |
| 言語 | F# (F# 4.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 481 bytes |
| コンパイル時間 | 6,248 ms |
| コンパイル使用メモリ | 186,324 KB |
| 実行使用メモリ | 35,780 KB |
| 最終ジャッジ日時 | 2024-09-20 21:26:39 |
| 合計ジャッジ時間 | 22,050 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 53 WA * 31 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (225 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
open System
let sqrtLong (n: int64) : int64 =
if n = 0L || n = 1L then n
else
let mutable x0 = n / 2L
let mutable x1 = (x0 + n / x0) / 2L
while x1 < x0 do
x0 <- x1
x1 <- (x0 + n / x0) / 2L
x0
[<EntryPoint>]
let yuki648 argv : int =
let n = 2L * Int64.Parse(Console.ReadLine())
let k = sqrtLong n
if n = k * (k + 1L) then
printfn "YES"
printfn "%i\n" k
else
printfn "NO"
0