結果
| 問題 | No.1059 素敵な集合 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-01-22 14:11:48 |
| 言語 | C# (.NET 10.0.201) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,434 bytes |
| 記録 | |
| コンパイル時間 | 6,990 ms |
| コンパイル使用メモリ | 174,304 KB |
| 実行使用メモリ | 198,880 KB |
| 最終ジャッジ日時 | 2026-04-14 23:02:51 |
| 合計ジャッジ時間 | 13,137 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 RE * 2 |
| other | WA * 4 RE * 15 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (88 ミリ秒)。 main -> /home/judge/data/code/bin/Release/net10.0/main.dll main -> /home/judge/data/code/bin/Release/net10.0/publish/
ソースコード
using System;
class Program
{
static void Main(string[] args)
{
// L と R を入力する
//Console.WriteLine("L を入力してください:");
string[] L_R = Console.ReadLine().Split(' ');
int L = int.Parse(L_R[0]);
//Console.WriteLine("R を入力してください:");
int R = int.Parse(L_R[1]);
// 集合 S を作成する
int[] S = new int[R - L + 1];
for (int i = 0; i < S.Length; i++)
{
S[i] = i + L;
}
// すべての組み合わせに対してコストを計算し、メモリに保存する
int[,] costs = new int[R - L + 1, R - L + 1];
for (int i = 0; i < costs.GetLength(0); i++)
{
for (int j = 0; j < costs.GetLength(1); j++)
{
costs[i, j] = S[i] % S[j];
}
}
// 最小コストを求める
int minCost = int.MaxValue;
for (int i = 0; i < costs.GetLength(0); i++)
{
for (int j = 0; j < costs.GetLength(1); j++)
{
// 最小コストを更新する
if (costs[i, j] < minCost)
{
minCost = costs[i, j];
}
}
}
// 結果を出力する
//Console.WriteLine("最小コストは {0} です。", minCost);
Console.WriteLine(minCost);
}
}