結果
| 問題 | No.29 パワーアップ |
| コンテスト | |
| ユーザー |
funakoshi
|
| 提出日時 | 2019-06-20 17:38:51 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 26 ms / 5,000 ms |
| コード長 | 1,533 bytes |
| 記録 | |
| コンパイル時間 | 820 ms |
| コンパイル使用メモリ | 110,736 KB |
| 実行使用メモリ | 26,520 KB |
| 最終ジャッジ日時 | 2025-10-24 21:10:25 |
| 合計ジャッジ時間 | 1,981 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.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace yukicoderTest
{
class Program
{
static void Main(string[] args)
{
string n = Console.ReadLine();
int[] itemcnt = new int[10];
int defeattime = int.Parse(n);
int pupcnt = 0;
for(int i=0;i<itemcnt.Length;i++)
{
itemcnt[i] = 0;
}
for(int i=0;i<defeattime;i++)
{
string item = Console.ReadLine();
string[] itemary = item.Split(' ');
int a = int.Parse(itemary[0]);
int b = int.Parse(itemary[1]);
int c = int.Parse(itemary[2]);
itemcnt[a - 1] = itemcnt[a - 1]+1;
itemcnt[b - 1] = itemcnt[b - 1]+1;
itemcnt[c - 1] = itemcnt[c - 1]+1;
}
int cnt = 0;
for (int i=0;i<itemcnt.Length;i++)
{
while (itemcnt[i] >= 2)
{
itemcnt[i] = itemcnt[i] - 2;
pupcnt++;
}
if (itemcnt[i] == 1)
{
itemcnt[i]--;
cnt++;
}
if (cnt == 4)
{
pupcnt++;
cnt = 0;
}
}
Console.WriteLine(pupcnt);
}
}
}
funakoshi