結果
問題 |
No.634 硬貨の枚数1
|
ユーザー |
![]() |
提出日時 | 2018-01-26 02:21:21 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 966 bytes |
コンパイル時間 | 899 ms |
コンパイル使用メモリ | 108,528 KB |
実行使用メモリ | 46,232 KB |
最終ジャッジ日時 | 2024-12-26 16:22:26 |
合計ジャッジ時間 | 142,959 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 23 WA * 6 TLE * 46 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections.Generic; namespace y { class Program { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); var li = new List<int>(); for (int i = 1; i <= n / 2; i++) { int p = i * (i + 1) / 2; if (p == n) { Console.WriteLine(1); return; } int e = i * (i + 1) / 2; li.Add(e); for (int j = li.Count - 1; j >= 0; j--) { if (li[j] < e / 2) { continue; } if (li[j] + e == n) { Console.WriteLine(2); return; } } } Console.WriteLine(3); } } }