Created
May 30, 2017 14:22
-
-
Save rainbow23/8d786d1c87c548ef852a5169716cbf3c to your computer and use it in GitHub Desktop.
paiza テストケースすべて通過
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public class Hello{ | |
public static void Main(){ | |
// 自分の得意な言語で | |
// Let's チャレンジ!! | |
var allExaminee = System.Console.ReadLine(); | |
int allExamineeNum = Int32.Parse(allExaminee); | |
//2次元要素一つ目は0なら理系, 1なら文系 | |
//[生徒のインデックス, 0、英語、数学、理科、国語、地理歴史] 理系 | |
//[生徒のインデックス, 1、英語、数学、理科、国語、地理歴史] 文系 | |
int[,] examineeResult = new int [allExamineeNum,6]; | |
for(int c1=0; c1< allExamineeNum; c1++){ | |
string testResult = System.Console.ReadLine(); | |
string [] tmp = testResult.Split(' '); | |
for(int c2=0; c2< tmp.Length; c2++){ | |
if(c2==0){ | |
if(tmp[c2] == "l"){ | |
examineeResult[c1,0] = 1; | |
}else if(tmp[c2] == "s"){ | |
examineeResult[c1,0] = 0; | |
} | |
continue; | |
} | |
examineeResult[c1,c2] = Int32.Parse(tmp[c2]); | |
} | |
} | |
int passingMarkManCount =0; | |
for(int c1 = 0; c1 < allExamineeNum; c1++){ | |
int plusEachTestResult = 0; | |
for(int c2 = 1; c2 < 6; c2++){ | |
//all plus is more than 350? | |
plusEachTestResult += examineeResult[c1, c2]; | |
} | |
if(plusEachTestResult < 350){ continue; } | |
//理系の受験者: 数学,理科をたして160点以上なら合格 | |
if(examineeResult[c1, 0] == 0){ | |
int r = examineeResult[c1, 2] + examineeResult[c1, 3]; | |
if(r >= 160) passingMarkManCount += 1; | |
} | |
//文系の受験者: 国語,地理歴史をたして160点以上なら合格 | |
else if(examineeResult[c1, 0] == 1){ | |
int r = examineeResult[c1, 4] + examineeResult[c1, 5]; | |
if(r >= 160) passingMarkManCount += 1; | |
} | |
} | |
System.Console.WriteLine("{0}", passingMarkManCount); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment