結果
| 問題 |
No.110 しましまピラミッド
|
| コンテスト | |
| ユーザー |
No
|
| 提出日時 | 2015-06-09 21:55:38 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 36 ms / 5,000 ms |
| コード長 | 2,884 bytes |
| コンパイル時間 | 928 ms |
| コンパイル使用メモリ | 114,096 KB |
| 実行使用メモリ | 29,560 KB |
| 最終ジャッジ日時 | 2024-12-31 11:09:21 |
| 合計ジャッジ時間 | 2,960 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 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;
namespace foryuki
{
class Program
{
static void Main(string[] args)
{
int Nw = int.Parse(Console.ReadLine());
int[] W = ConvertStringArrayToIntArray(Console.ReadLine().Split());
int Nb = int.Parse(Console.ReadLine());
int[] B = ConvertStringArrayToIntArray(Console.ReadLine().Split());
int cnt1 = 0;
int Wm = 0;
int Bm = 0;
while (true)
{
var q = from x in W
where x > Bm
orderby x
select x;
if (q.Count() != 0)
{
Wm = q.Min();
cnt1++;
}
else
{
break;
}
var p = from x in B
where x > Wm
orderby x
select x;
if (p.Count() != 0)
{
Bm = p.Min();
cnt1++;
}
else
{
break;
}
}
//---------------------------
int cnt2 = 0;
Wm = 0;
Bm = 0;
while (true)
{
var p = from x in B
where x > Wm
orderby x
select x;
if (p.Count() != 0)
{
Bm = p.Min();
cnt2++;
}
else
{
break;
}
var q = from x in W
where x > Bm
orderby x
select x;
if (q.Count() != 0)
{
Wm = q.Min();
cnt2++;
}
else
{
break;
}
}
Console.WriteLine(Math.Max( cnt1,cnt2));
}
//-------------------------------------------------------------
static int[] ConvertStringArrayToIntArray(string[] str)
{
int[] b = Array.ConvertAll<string, int>(str, delegate(string value)
{
return int.Parse(value);
});
return b;
}
static List<int> ConvertStringArrayToIntList(string[] str)
{
var list = new List<int>();
foreach (var c in str)
{
list.Add(int.Parse(c));
}
return list;
}
}
}
No