"SWEA 1288 새로운 불면증 치료법"의 두 판 사이의 차이

15번째 줄: 15번째 줄:
class Solution
class Solution
{
{
public static void main(String args[]) throws Exception
    public static void main(String args[]) throws Exception
{
    {
Scanner sc = new Scanner(System.in);
    Scanner sc = new Scanner(System.in);
int T;
    int T;
T=sc.nextInt();
    T=sc.nextInt();
          
          
         int N, i, cur, q, temp;
         int N, i, cur, q, temp;
         Set seen = new HashSet<Integer>();
         Set seen = new HashSet<Integer>();
for(int test_case = 1; test_case <= T; test_case++)
    for(int test_case = 1; test_case <= T; test_case++)
{
    {
             N = sc.nextInt();
             N = sc.nextInt();
             seen.clear();
             seen.clear();
36번째 줄: 36번째 줄:
             }
             }
             System.out.format("#%d %d\n", test_case, cur);
             System.out.format("#%d %d\n", test_case, cur);
}
    }
}
    }
}
}
</source>
</source>

2018년 12월 16일 (일) 17:21 판

1 개요

SWEA 1940 가랏! RC카!
SW Expert 아카데미
# 문제 풀이

틀:SWEA 난이도 2-3

2 C++

3 Java

import java.util.*;
class Solution
{
    public static void main(String args[]) throws Exception
    {
    	Scanner sc = new Scanner(System.in);
    	int T;
    	T=sc.nextInt();
        
        int N, i, cur, q, temp;
        Set seen = new HashSet<Integer>();
    	for(int test_case = 1; test_case <= T; test_case++)
    	{
            N = sc.nextInt();
            seen.clear();
            for(i=1; ; i++) {
                cur = N*i;
                for(temp=cur; temp>0; temp/=10) {
                    q = temp%10;
                    seen.add(q);
                }
                if(seen.size()>9) break;
            }
            System.out.format("#%d %d\n", test_case, cur);
    	}
    }
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}