結果
問題 | No.338 アンケート機能 |
ユーザー |
![]() |
提出日時 | 2017-09-17 12:47:24 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 132 ms / 2,000 ms |
コード長 | 688 bytes |
コンパイル時間 | 6,328 ms |
コンパイル使用メモリ | 77,232 KB |
実行使用メモリ | 41,528 KB |
最終ジャッジ日時 | 2024-11-08 01:51:39 |
合計ジャッジ時間 | 9,055 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
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)); } }