結果
問題 |
No.864 四方演算
|
ユーザー |
![]() |
提出日時 | 2019-08-16 22:05:59 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,054 bytes |
コンパイル時間 | 803 ms |
コンパイル使用メモリ | 103,424 KB |
実行使用メモリ | 17,792 KB |
最終ジャッジ日時 | 2024-09-22 16:47:18 |
合計ジャッジ時間 | 2,476 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 1 RE * 26 |
コンパイルメッセージ
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; using System.Linq; using System.Text; using System.Threading.Tasks; class Program { static void Main(string[] args) { //入力 int N = int.Parse(Console.ReadLine()); int K = int.Parse(Console.ReadLine()); //回答となるペア数 int pair = 0; for (int i = 2; i <= 2 * N; i++) { if (K % i != 0) { continue; } if (K / i > 2 * N) { continue; } int combi_ac = 0; int combi_bd = 0; //a,cの組み合わせ if (i >= N + 2) { combi_ac = 2 * N - i + 1; } else { combi_ac = i - 1; } //b,dの組み合わせ if (K / i >= N + 2) { combi_bd = 2 * N - (K / i) + 1; } else { combi_bd = (K / i) - 1; } pair += combi_ac * combi_bd; } Console.WriteLine(pair); } }