結果

問題 No.970 数列変換マシン
ユーザー guriceringuricerin
提出日時 2020-01-18 12:12:54
言語 F#
(F# 4.0)
結果
AC  
実行時間 145 ms / 2,000 ms
コード長 983 bytes
コンパイル時間 4,048 ms
コンパイル使用メモリ 162,688 KB
実行使用メモリ 40,372 KB
最終ジャッジ日時 2023-09-09 12:30:51
合計ジャッジ時間 8,187 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 143 ms
38,344 KB
testcase_01 AC 145 ms
38,332 KB
testcase_02 AC 144 ms
40,372 KB
testcase_03 AC 141 ms
37,064 KB
testcase_04 AC 133 ms
39,100 KB
testcase_05 AC 143 ms
37,728 KB
testcase_06 AC 119 ms
35,752 KB
testcase_07 AC 139 ms
36,888 KB
testcase_08 AC 141 ms
36,952 KB
testcase_09 AC 76 ms
22,656 KB
testcase_10 AC 76 ms
22,652 KB
testcase_11 AC 75 ms
22,844 KB
testcase_12 AC 75 ms
22,672 KB
testcase_13 AC 73 ms
22,636 KB
testcase_14 AC 76 ms
22,944 KB
testcase_15 AC 66 ms
22,480 KB
testcase_16 AC 67 ms
22,392 KB
testcase_17 AC 65 ms
22,564 KB
testcase_18 AC 67 ms
22,380 KB
testcase_19 AC 68 ms
24,528 KB
testcase_20 AC 67 ms
24,488 KB
testcase_21 AC 69 ms
22,528 KB
testcase_22 AC 67 ms
22,536 KB
testcase_23 AC 68 ms
24,440 KB
testcase_24 AC 68 ms
22,536 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

open System
open System.Collections.Generic

[<AutoOpen>]
module Cin =
    let read f = stdin.ReadLine() |> f
    let reada f = stdin.ReadLine().Split() |> Array.map f
    let readChars() = read string |> Seq.toArray
    let readInts() = readChars() |> Array.map (fun x -> Convert.ToInt32(x.ToString()))

[<AutoOpen>]
module Cout =
    let writer = new IO.StreamWriter(new IO.BufferedStream(Console.OpenStandardOutput()))
    let print (s: string) = writer.Write s
    let println (s: string) = writer.WriteLine s
    let inline puts (s: ^a) = string s |> println

let main() =
    let n = read int
    let ys = reada int64
    let ysum = ys |> Array.sum
    let xs = Array.zeroCreate n
    // 式変形すると
    // xi = -(n-2) * yi + (yの総和からyiを引いた値)
    for i in 0..n-1 do
        let a = (n-2) * -1 |> int64
        let x = (a * ys.[i]) + (ysum - ys.[i])
        xs.[i] <- x

    let ans = String.Join(" ", xs)
    ans |> puts
    ()

main()
writer.Close()
0