글
백준 2480번 주사위 세 개(JAVA, C#)
자바
import java.util.*;
public class Main{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int a, b, c;
a = sc.nextInt();
b = sc.nextInt();
c = sc.nextInt();
int prize = 0;
if(a == b && b == c)
{
System.out.print(10000+(a*1000));
}
else if(a == b || a == c)
{
System.out.print(1000+(a*100));
}
else if(b == c)
{
System.out.print(1000+(b*100));
}
else
{
System.out.print((Math.max(a, Math.max(b, c))*100));
}
}
}
///////////////
C#
using System;
using System.Collections.Generic;
using System.Linq;
namespace Baekjoon {
class Program {
static void Main(string[] args) {
string s = Console.ReadLine();
string[] s1 = s.Split();
int a = int.Parse(s1[0]);
int b = int.Parse(s1[1]);
int c = int.Parse(s1[2]);
if(a == b && b == c)
{
Console.WriteLine(10000+(a*1000));
}
else if(a == b || a == c)
{
Console.WriteLine(1000+(a*100));
}
else if(b == c)
{
Console.WriteLine(1000+(b*100));
}
else
{
if (a > b && a > c)
{
Console.WriteLine(100 * a);
}
else if(b > c)
{
Console.WriteLine(100 * b);
}
else
{
Console.WriteLine(100 * c);
}
}
}
}
}
'백준 프로그래밍' 카테고리의 다른 글
백준 10950번 A+B-3(JAVA, C#) (0) | 2023.02.14 |
---|---|
백준 2739번 구구단(JAVA, C#) (0) | 2023.02.14 |
백준 2525번 오븐 시계(JAVA, C#) (0) | 2023.02.12 |
백준 2884번 알람 시계(JAVA, C#) (0) | 2023.02.12 |
백준 14681번 사분면(JAVA, C#) (0) | 2023.02.12 |