結果
問題 | No.800 四平方定理 |
ユーザー | chika0707 |
提出日時 | 2019-03-17 21:46:48 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,848 bytes |
コンパイル時間 | 1,937 ms |
コンパイル使用メモリ | 70,096 KB |
実行使用メモリ | 86,728 KB |
最終ジャッジ日時 | 2023-09-22 04:54:43 |
合計ジャッジ時間 | 33,752 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 74 ms
21,268 KB |
testcase_01 | AC | 81 ms
22,376 KB |
testcase_02 | AC | 76 ms
22,304 KB |
testcase_03 | AC | 78 ms
24,392 KB |
testcase_04 | AC | 77 ms
21,252 KB |
testcase_05 | AC | 78 ms
22,280 KB |
testcase_06 | AC | 84 ms
22,312 KB |
testcase_07 | AC | 78 ms
20,392 KB |
testcase_08 | AC | 85 ms
22,256 KB |
testcase_09 | AC | 84 ms
24,364 KB |
testcase_10 | AC | 1,016 ms
54,168 KB |
testcase_11 | AC | 1,138 ms
55,084 KB |
testcase_12 | AC | 1,157 ms
52,828 KB |
testcase_13 | AC | 1,110 ms
52,040 KB |
testcase_14 | AC | 1,112 ms
55,124 KB |
testcase_15 | AC | 1,116 ms
55,052 KB |
testcase_16 | AC | 1,126 ms
55,228 KB |
testcase_17 | AC | 1,171 ms
55,392 KB |
testcase_18 | AC | 1,186 ms
55,248 KB |
testcase_19 | AC | 1,203 ms
53,124 KB |
testcase_20 | AC | 67 ms
21,084 KB |
testcase_21 | AC | 63 ms
20,948 KB |
testcase_22 | AC | 1,182 ms
53,636 KB |
testcase_23 | TLE | - |
testcase_24 | TLE | - |
testcase_25 | TLE | - |
testcase_26 | AC | 63 ms
21,004 KB |
testcase_27 | AC | 63 ms
21,028 KB |
testcase_28 | TLE | - |
testcase_29 | TLE | - |
testcase_30 | TLE | - |
testcase_31 | AC | 1,950 ms
79,716 KB |
testcase_32 | TLE | - |
ソースコード
using System; using System.Collections.Generic; using System.Linq; using static Input; public class Prog { private const int INF = 1000000007; private const long INFINITY = 9223372036854775807; public static void Main() { int N = NextInt(); long D = NextLong(); Dictionary<long, long> xy = new Dictionary<long, long>(); for (int x = 1; x <= N; x++) for (int y = 1; y <= N; y++) { long c = (long)Math.Pow(x, 2) + (long)Math.Pow(y, 2); if (!xy.ContainsKey(c)) xy[c] = 0; xy[c]++; } long ans = 0; for (int z = 1; z <= N; z++) for (int w = 1; w <= N; w++) { long c = (long)Math.Pow(z, 2) - (long)Math.Pow(w, 2); if (xy.ContainsKey(D - c)) ans += xy[D - c]; } Console.WriteLine(ans); } } public class Input { private static Queue<string> q = new Queue<string>(); private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); } public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); } public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); } public static string NextString() { Confirm(); return q.Dequeue(); } public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); } public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); } public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); } public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); } public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); } }