結果
| 問題 | No.29 パワーアップ | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2022-06-08 11:10:01 | 
| 言語 | C#(csc) (csc 3.9.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 25 ms / 5,000 ms | 
| コード長 | 2,530 bytes | 
| コンパイル時間 | 830 ms | 
| コンパイル使用メモリ | 113,020 KB | 
| 実行使用メモリ | 26,656 KB | 
| 最終ジャッジ日時 | 2025-10-24 21:18:34 | 
| 合計ジャッジ時間 | 2,224 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 22 | 
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Diagnostics;
namespace yukicoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //敵を倒す回数
            int N = int.Parse(Console.ReadLine());
            //獲得したアイテムを収納する
            int[] s = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
            //獲得アイテム
            int[] n =new int[3];
            //敵を倒す回数分ループ
            for (int x = 0; x < N; x++)
            {
                //敵を倒す1回分 入力して配列
                string[] str = Console.ReadLine().Split(' ');
                //アイテム番号を配列に入れる
                for (int i = 0; i < 3; i++)
                {
                    int a = int.Parse(str[i]);
                    n[i] = a;
                }
                //獲得したアイテムを収納する 
                for (int j = 1; j <= 10; j++)
                {
                    for (int k = 1; k <= 3; k++)
                    {
                        //同じ数字なら
                        if (j == n[k - 1])
                        {
                            //プラス1する
                            s[j - 1] += 1;
                        }
                    }
                    //Debug.WriteLine(s[j - 1]);
                }
            }
            //合計値
            int num = 0;
            int num1 = 0;
            int num2 = 0;
            //あまりの数字を入れる
            int ans2 = 0;
            //獲得したアイテムを収納した個数
            for (int i=1;i<=10;i++)
            {
                //割ったもの
                int ans = 0;
                int ans1 = 0;
                int ans3 = 0;
                //同じ数字が2つあれば、パワーアップする
                ans = s[i - 1] / 2;
                num += ans;
                //余れば
                ans1 = s[i - 1] % 2;
                if(ans1>0)
                {
                    //余った数字をans2に入れる
                    ans2 += ans1;
                }
                //10まで調べて、余った数字を4で割る
                if(i==10)
                {
                    ans3 = ans2 / 4;
                    num1 += ans3;
                    //パワーアップした分の合計を求める
                    num2 = num + num1;
                }
            }
            Console.WriteLine(num2.ToString());
        }
    }
}
            
            
            
        