SWEA

[SWEA] +=

itsnot4me 2024. 9. 20. 19:20

https://swexpertacademy.com/main/code/problem/problemDetail.do?problemLevel=2&contestProbId=AZD8K_UayDoDFAVs&categoryId=AZD8K_UayDoDFAVs&categoryType=CODE&problemTitle=&orderBy=FIRST_REG_DATETIME&selectCodeLang=ALL&select-1=2&pageSize=10&pageIndex=1

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com

import java.util.Scanner;
import java.io.FileInputStream;
class Solution
{
	public static void main(String args[]) throws Exception
	{
		Scanner sc = new Scanner(System.in);
		int T;
		T=sc.nextInt();

		for(int test_case = 1; test_case <= T; test_case++)
		{
			int T1 = sc.nextInt();
            int T2 = sc.nextInt();
            int T3 = sc.nextInt();
         	int score = 0;
            while(T1<=T3 && T2<=T3){
           	if(T1>T2){
              T2 = T1 + T2;
              score +=1;
            }
            else if(T2>T1){
              T1= T1 + T2;
              score +=1;
            } 
            else if(T1==T2){
             T1= T1+ T2;
                score +=1;
            }
            }
            System.out.println(score);
		}
	}
}

 

항상 작은 수에 더해진다, 그치만 같은 케이스가 있을 수 있는 것만 유의

'SWEA' 카테고리의 다른 글

[SWEA] 패턴 마디의 길이  (0) 2024.09.21
[SWEA] 간단한 369게임  (0) 2024.09.20
[SWEA] 거꾸로 출력해 보아요  (0) 2024.09.20
[SWEA] 더블더블  (0) 2024.09.20
[SWEA] 1대1 가위바위보  (0) 2024.09.20