結果

問題 No.338 アンケート機能
ユーザー fjafjafjafjafjafja
提出日時 2017-09-17 12:47:24
言語 Java21
(openjdk 21)
結果
AC  
実行時間 135 ms / 2,000 ms
コード長 688 bytes
コンパイル時間 3,478 ms
コンパイル使用メモリ 77,928 KB
実行使用メモリ 54,524 KB
最終ジャッジ日時 2024-04-25 14:53:59
合計ジャッジ時間 8,452 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
54,400 KB
testcase_01 AC 130 ms
54,084 KB
testcase_02 AC 115 ms
53,128 KB
testcase_03 AC 132 ms
54,168 KB
testcase_04 AC 130 ms
54,400 KB
testcase_05 AC 135 ms
54,336 KB
testcase_06 AC 132 ms
53,864 KB
testcase_07 AC 130 ms
54,032 KB
testcase_08 AC 130 ms
54,212 KB
testcase_09 AC 131 ms
54,140 KB
testcase_10 AC 131 ms
54,164 KB
testcase_11 AC 130 ms
54,320 KB
testcase_12 AC 129 ms
54,124 KB
testcase_13 AC 131 ms
54,176 KB
testcase_14 AC 128 ms
54,276 KB
testcase_15 AC 115 ms
53,092 KB
testcase_16 AC 128 ms
54,156 KB
testcase_17 AC 130 ms
54,212 KB
testcase_18 AC 128 ms
54,376 KB
testcase_19 AC 130 ms
53,972 KB
testcase_20 AC 130 ms
54,416 KB
testcase_21 AC 131 ms
54,284 KB
testcase_22 AC 129 ms
54,368 KB
testcase_23 AC 130 ms
53,984 KB
testcase_24 AC 129 ms
54,080 KB
testcase_25 AC 129 ms
54,316 KB
testcase_26 AC 130 ms
54,136 KB
testcase_27 AC 128 ms
54,524 KB
testcase_28 AC 130 ms
54,516 KB
testcase_29 AC 115 ms
53,068 KB
testcase_30 AC 126 ms
54,260 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

import java.util.Arrays;
import java.util.Scanner;

public class N338
{
	public static void main(String[] args)
	{
		Scanner sc=new Scanner(System.in);
		int[] a=new int[2];a[0]=sc.nextInt();a[1]=sc.nextInt();
		double ans=2;
		int end=0;
		if((a[0]==100&&a[1]==0)||(a[0]==0&&a[1]==100)){ans=1;}
		else if(a[0]+a[1]==0){ans=0;}
		else if(a[0]==a[1]){}
		else
		{
			Arrays.sort(a);
			while(true)
			{
				for(int i=1;i<=ans/2;i++)
				{
					if(a[0]==Math.round(100.0*((double)i)/ans)&&a[1]==Math.round(100.0*(ans-((double)i))/ans))
					{
						end=1;
						break;
					}
				}
				if(end==1){break;}
				ans++;
			}
		}
		System.out.println(Math.round(ans));
	}

}
0