結果
問題 | No.1231 Make a Multiple of Ten |
ユーザー |
|
提出日時 | 2020-09-23 14:15:48 |
言語 | Nim (2.2.0) |
結果 |
AC
|
実行時間 | 74 ms / 2,000 ms |
コード長 | 762 bytes |
コンパイル時間 | 3,217 ms |
コンパイル使用メモリ | 72,972 KB |
実行使用メモリ | 32,628 KB |
最終ジャッジ日時 | 2024-06-27 22:39:56 |
合計ジャッジ時間 | 5,038 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'algorithm' [UnusedImport] /home/judge/data/code/Main.nim(1, 19) Warning: imported and not used: 'deques' [UnusedImport] /home/judge/data/code/Main.nim(1, 27) Warning: imported and not used: 'heapqueue' [UnusedImport] /home/judge/data/code/Main.nim(1, 77) Warning: imported and not used: 'tables' [UnusedImport] /home/judge/data/code/Main.nim(1, 44) Warning: imported and not used: 'sets' [UnusedImport] /home/judge/data/code/Main.nim(1, 70) Warning: imported and not used: 'sugar' [UnusedImport]
ソースコード
import algorithm, deques, heapqueue, math, sets, sequtils, strutils, sugar, tables proc input*(): string = return stdin.readLine proc chmax*[T: SomeNumber](num0: var T, num1: T) = num0 = max(num0, num1) proc chmin*[T: SomeNumber](num0: var T, num1: T) = num0 = min(num0, num1) proc `%=`*[T: SomeInteger](num0: var T, num1: T) = num0 = num0 mod num1 var A: seq[int] dp: array[200010, array[10, int]] proc solve() = let N = input().parseInt A = input().split.map(parseInt) dp[0][0] = 1 for i in 0..<N: for j in 0..9: if 0 < dp[i][j]: dp[i + 1][j].chmax(dp[i][j]) dp[i + 1][(j + A[i]) mod 10].chmax(dp[i][j] + 1) echo dp[N][0] - 1 when is_main_module: solve()