728x90
SMALL

자바

 

 

 

import java.util.*;

public class Main{
public static void main(String args[]){
  Scanner sc = new Scanner(System.in);

    while(true)
    {
      int a = sc.nextInt();
      int b = sc.nextInt();
        
        if(a == 0 && b == 0)
        {
            sc.close();
            break;
        }
        System.out.println(a+b);
    }
      
}
}

 

 

 

///////////////////////////

 

 

C#

 

 

using System;

namespace Baekjoon {
    class Program {
        static void Main(string[] args) {

      while(true)
      {
          string[] s = Console.ReadLine().Split();
          int a = int.Parse(s[0]);
          int b = int.Parse(s[1]);
        
        if(a == 0 && b == 0)
        {
            break;
        }
        Console.WriteLine(a+b);
      }  
        }
    }
}

728x90

설정

트랙백

댓글

728x90
SMALL

자바

 

 

 

import java.util.*;

 

public class Main{

public static void main(String args[]){

  Scanner in = new Scanner(System.in);

  int a = in.nextInt();

  in.close();

 

  for (int i = 1; i <= a; i++)

  {

    for (int j = 1; j <= a - i; j++) 

    {

        System.out.print(" ");

    }

    for (int k = 0; k < i; k++)

    {

        System.out.print("*");

    }

    System.out.println();

}

}

}

 

 

 

//////////////////////////////////

 

 

C#

 

 

using System;

public class Example
{
    public static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());

        for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < n-i-1; j++)
                {
                    Console.Write(" ");
                }
                for (int j = 0; j < i+1; j++)
                {
                    Console.Write("*");
                }
                Console.Write("\n");
            }
    }
}

728x90

설정

트랙백

댓글

728x90
SMALL

자바

 

 

 

import java.util.*;

public class Main{
public static void main(String args[]){
  Scanner sc = new Scanner(System.in);
  int a = sc.nextInt();
    
        for(int i=1; i<=a; i++)
        {
            System.out.println("*".repeat(i));
        }
    }
}

 

///////////////////

 

 

C#

 

 

 

using System;

public class Example
{
    public static void Main()
    {
        String[] s;

        Console.Clear();
        s = Console.ReadLine().Split(' ');

        int n = Int32.Parse(s[0]);

        for (int i = 1; i <= n; i++)
        {
            for (int j = 1; j <= i; j++)
            {
                Console.Write("*");
            }
            Console.WriteLine();
        }
    }
}

728x90

설정

트랙백

댓글

728x90
SMALL

자바

 

 

import java.util.*;

public class Main{
public static void main(String args[]){
  Scanner sc = new Scanner(System.in);
  int a = sc.nextInt();

    for(int i = 1;i<=a;i++)
    {
        int b = sc.nextInt();
        int c = sc.nextInt();
        System.out.println("Case #" + i + ": " + b + " + " + c + " = " + (b + c));
    }
    sc.close();
}
}

 

 

//////////////////

 

 

C#

 

 

using System;

namespace Baekjoon {
    class Program {
        static void Main(string[] args) {
            int t = int.Parse(Console.ReadLine()); // 개수 t

            for (int i = 1; i <= t; i++)
            {
                string[] s = Console.ReadLine().Split();
                int b = int.Parse(s[0]);
                int c = int.Parse(s[1]);

                Console.WriteLine("Case #" + i + ": " + b + " + " + c + " = " + (b + c));
            }
        }
    }
}

 

728x90

설정

트랙백

댓글

728x90
SMALL

자바

 

 

import java.util.*;

public class Main{
public static void main(String args[]){
  Scanner sc = new Scanner(System.in);
  int a = sc.nextInt();

    for(int i = 1;i<=a;i++)
    {
        int b = sc.nextInt();
        int c = sc.nextInt();
        System.out.println("Case #" + i + ": " + (b + c));
    }
    sc.close();
}
}

 

 

/////////////////

 

 

C#

 

 

using System;

namespace Baekjoon {
    class Program {
        static void Main(string[] args) {
            int t = int.Parse(Console.ReadLine()); // 개수 t

            for (int i = 1; i <= t; i++)
            {
                string[] s = Console.ReadLine().Split();
                int b = int.Parse(s[0]);
                int c = int.Parse(s[1]);

                Console.WriteLine("Case #" + i + ": " + (b + c));
            }
        }
    }
}

 

 

728x90

'백준 프로그래밍' 카테고리의 다른 글

백준 별 찍기 - 1(JAVA, C#)  (0) 2023.02.14
백준 11022번 A + B - 8(JAVA, C#)  (0) 2023.02.14
백준 15552번 빠른 A+B(Java, C#)  (0) 2023.02.14
백준 25304번 영수증(JAVA, C#)  (0) 2023.02.14
백준 8393번 합(JAVA, C#)  (0) 2023.02.14

설정

트랙백

댓글

728x90
SMALL

자바

 

 

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.StringTokenizer;
 
public class Main {
 
public static void main(String[] args) throws IOException {
 
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
 
int N = Integer.parseInt(br.readLine());
StringTokenizer st;
 
for (int i = 0; i < N; i++) 
{
    st = new StringTokenizer(br.readLine()," ");
    bw.write((Integer.parseInt(st.nextToken()) + Integer.parseInt(st.nextToken()))+ "\n");
}
        
br.close();
bw.flush();
bw.close();
 
}
}

 

 

//////////////////////

 

 

C#

 

 

using System;
using System.Text;

namespace Baekjoon {
    class Program {
        static void Main() {
             StringBuilder sb = new StringBuilder();
            int b = int.Parse(Console.ReadLine());
            
            for(int i = 1;i<=b;i++)
            {
                string[] ss = Console.ReadLine().Split();
                int c = int.Parse(ss[0]);
                int d = int.Parse(ss[1]);
                sb.Append(c + d + "\n");
            }
            Console.WriteLine(sb.ToString());
        }
    }
}

728x90

'백준 프로그래밍' 카테고리의 다른 글

백준 11022번 A + B - 8(JAVA, C#)  (0) 2023.02.14
백준 11021번 A+B-7(JAVA, C#)  (0) 2023.02.14
백준 25304번 영수증(JAVA, C#)  (0) 2023.02.14
백준 8393번 합(JAVA, C#)  (0) 2023.02.14
백준 10950번 A+B-3(JAVA, C#)  (0) 2023.02.14

설정

트랙백

댓글

728x90
SMALL

자바

 

 

import java.util.*;

public class Main{
public static void main(String args[]){
  Scanner sc = new Scanner(System.in);
  int a = sc.nextInt();
    int b = sc.nextInt();
    int sum = 0;
    
    for(int i = 1;i<=b;i++)
    {
        int c = sc.nextInt();
        int d = sc.nextInt();
        a = a - c * d;
    }
    
    if(a == 0)
    {
        System.out.println("Yes");
    }
    else
    {
        System.out.println("No");
    }
}
}

 

 

/////////////////////

 

 

C#

 

 

using System;

namespace Baekjoon {
    class Program {
        static void Main() {
            string s = Console.ReadLine();
            string s1 = Console.ReadLine();
            
            int a = int.Parse(s);
            int b = int.Parse(s1);
            
            for(int i = 1;i<=b;i++)
            {
                 string s2 = Console.ReadLine(); 
                string[] ss = s2.Split();
                int c = int.Parse(ss[0]);
                int d = int.Parse(ss[1]);
                a = a - c*d;
            }
            
            if(a == 0)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
             
        }
    }
}

728x90

'백준 프로그래밍' 카테고리의 다른 글

백준 11021번 A+B-7(JAVA, C#)  (0) 2023.02.14
백준 15552번 빠른 A+B(Java, C#)  (0) 2023.02.14
백준 8393번 합(JAVA, C#)  (0) 2023.02.14
백준 10950번 A+B-3(JAVA, C#)  (0) 2023.02.14
백준 2739번 구구단(JAVA, C#)  (0) 2023.02.14

설정

트랙백

댓글

728x90
SMALL

자바

 

 

import java.util.*;

public class Main{
public static void main(String args[]){
  Scanner sc = new Scanner(System.in);
  int a = sc.nextInt();
    int sum = a*(a+1)/2;
    System.out.println(sum);
}
}

 

 

//////////////////////////

 

 

C#

 

 

using System;

namespace Baekjoon {
    class Program {
        static void Main(string[] args) {
            string s = Console.ReadLine();
            int a = int.Parse(s);

    for(int i = 1;i<=9;i++)
    {
        int mul = a*i;
        Console.WriteLine(a + " * " + i + " = " + mul);
    }

        }
    }
}

 

728x90

설정

트랙백

댓글