結果
| 問題 | No.832 麻雀修行中 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-05-22 11:23:44 |
| 言語 | C# (.NET 10.0.201) |
| 結果 |
AC
|
| 実行時間 | 74 ms / 2,000 ms |
| コード長 | 2,650 bytes |
| 記録 | |
| コンパイル時間 | 15,782 ms |
| コンパイル使用メモリ | 175,324 KB |
| 実行使用メモリ | 192,300 KB |
| 最終ジャッジ日時 | 2026-05-22 11:24:04 |
| 合計ジャッジ時間 | 17,236 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_1 |
| 純コード判定待ち |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 25 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (111 ミリ秒)。 main -> /home/judge/data/code/bin/Release/net10.0/main.dll main -> /home/judge/data/code/bin/Release/net10.0/publish/
ソースコード
using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;
class Program
{
static int NN => int.Parse(ReadLine());
static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray();
public static void Main()
{
Solve();
}
static void Solve()
{
var s = ReadLine();
var count = new int[9];
foreach (var c in s) ++count[c - '1'];
for (var i = 0; i < 9; ++i)
{
if (count[i] == 4) continue;
var ncount = (int[]) count.Clone();
++ncount[i];
if (Judge(ncount)) WriteLine(i + 1);
}
}
static bool Judge(int[] count)
{
if (Judge2(count, true)) return true;
for (var i = 0; i < 7; ++i)
{
--count[i];
--count[i + 1];
--count[i + 2];
if (Judge2(count, false)) return true;
for (var j = i; j < 7; ++j)
{
--count[j];
--count[j + 1];
--count[j + 2];
if (Judge2(count, false)) return true;
for (var k = j; k < 7; ++k)
{
--count[k];
--count[k + 1];
--count[k + 2];
if (Judge2(count, false)) return true;
for (var l = k; l < 7; ++l)
{
--count[l];
--count[l + 1];
--count[l + 2];
if (Judge2(count, false)) return true;
++count[l];
++count[l + 1];
++count[l + 2];
}
++count[k];
++count[k + 1];
++count[k + 2];
}
++count[j];
++count[j + 1];
++count[j + 2];
}
++count[i];
++count[i + 1];
++count[i + 2];
}
return false;
}
static bool Judge2(int[] count, bool isAll)
{
if (count.Any(ci => ci < 0)) return false;
var two = 0;
var three = 0;
var other = 0;
foreach (var ci in count)
{
if (ci == 2) ++two;
else if (ci == 3) ++three;
else if (ci > 0) ++other;
}
if (other > 0) return false;
if (isAll && two == 7) return true;
if (two == 1) return true;
return false;
}
}