結果
問題 | No.83 最大マッチング |
ユーザー |
![]() |
提出日時 | 2016-05-30 11:06:03 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 323 ms / 5,000 ms |
コード長 | 895 bytes |
コンパイル時間 | 3,363 ms |
コンパイル使用メモリ | 76,240 KB |
実行使用メモリ | 56,968 KB |
最終ジャッジ日時 | 2024-10-07 17:58:11 |
合計ジャッジ時間 | 6,479 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
package yukicoder; import java.util.Scanner; public class Yuki83{ public static void main(String[] args) { Scanner scan = new Scanner(System.in); int num = scan.nextInt(); scan.close(); int two_num = 0; int three_num = 0; String ans = ""; if( num % 2 == 0){ two_num = num / 2; ans = strNumbers(two_num,three_num); } else if(num % 2 == 1){ two_num = (num / 2) -1; three_num ++; ans = strNumbers(two_num,three_num); } System.out.println(ans); } private static String strNumbers(int two_num,int three_num){ String ans = ""; if(three_num != 0) { for(int i =0; i < three_num; i++ ) { ans += "7"; } for(int i =0; i < two_num; i++ ) { ans += "1"; } } else { for(int i =0; i < two_num; i++ ) { ans += "1"; } for(int i =0; i < three_num; i++ ) { ans += "7"; } } return ans; } }