Skip to content

Instantly share code, notes, and snippets.

@rainbow23
Last active June 11, 2017 14:42
Show Gist options
  • Save rainbow23/e2ec62431c1e75b3dd158c15776bff7d to your computer and use it in GitHub Desktop.
Save rainbow23/e2ec62431c1e75b3dd158c15776bff7d to your computer and use it in GitHub Desktop.
paiza testcase失敗している
using System;
namespace kaimono
{
public class Kaimono2
{
public int kind;
public int price;
public Kaimono2(int kind, int price)
{
this.kind = kind;
this.price = price;
}
public int GetPointFromPrice()
{
//if(price <= 100)return 0;
int basePrice = price / 100;
return (basePrice * CalcPointFromKind());
}
//100円毎のポイント
private int CalcPointFromKind()
{
int point = 0;
switch (kind)
{
case 0:
point = 5;
break;
case 1:
point = 3;
break;
case 2:
point = 2;
break;
case 3:
point = 1;
break;
}
return point;
}
}
public class Hello
{
public static void Main()
{
// 自分の得意な言語で
// Let's チャレンジ!!
string allProducts = System.Console.ReadLine();
int aProducts = Int32.Parse(allProducts);
Kaimono2[] productArray = new Kaimono2[aProducts];
int allPoint = 0;
for (int i = 0; i < aProducts; i++)
{
string productsString = System.Console.ReadLine();
//0 ≦ v_i ≦ 3 商品数
//10 ≦ p_i ≦ 10000 商品値段
string[] info = productsString.Split(' ');
productArray[i] = new Kaimono2(Int32.Parse(info[0]), Int32.Parse(info[1]));
/*
System.Console.WriteLine("i:{0} kind:{1} price:{2} Point:{3}",
i,
productArray[i].kind,
productArray[i].price,
productArray[i].GetPointFromPrice()
);
*/
allPoint += productArray[i].GetPointFromPrice();
}
System.Console.WriteLine(allPoint);
//productArray[0] = new Product(0, 3200);
//System.Console.WriteLine("{0} {1}", productArray[0].kind, productArray[0].price);
//System.Console.WriteLine("{0}", productArray[0].GetPointFromPrice());
//System.Console.WriteLine("{0} {1}",productArray[0].kind, productArray[0].price);
//System.Console.WriteLine("{0}", productArray[0].GetPointFromPrice());
for (int i = 0; i < aProducts; i++)
{
// allPoint += productArray[i].GetPointFromPrice();
}
//System.Console.WriteLine(allPoint);
}
}
}
/*
1 4750
2 2860
2 8420
1 4520
0 2450
1 3540
1 4960
1 590
3 2160
3 9160
1 7900
3 8730
0 9450
1 8940
1 8680
0 4530
0 4420
1 2320
3 7960
0 2110
0 2020
2 3650
0 6280
2 3270
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment