結果
問題 | No.83 最大マッチング |
ユーザー | ちよちゃん |
提出日時 | 2016-05-30 11:06:03 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 337 ms / 5,000 ms |
コード長 | 895 bytes |
コンパイル時間 | 3,547 ms |
コンパイル使用メモリ | 77,176 KB |
実行使用メモリ | 46,136 KB |
最終ジャッジ日時 | 2024-04-16 18:25:09 |
合計ジャッジ時間 | 6,574 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 136 ms
41,172 KB |
testcase_01 | AC | 137 ms
41,492 KB |
testcase_02 | AC | 136 ms
41,492 KB |
testcase_03 | AC | 137 ms
41,572 KB |
testcase_04 | AC | 136 ms
41,520 KB |
testcase_05 | AC | 136 ms
41,628 KB |
testcase_06 | AC | 136 ms
41,664 KB |
testcase_07 | AC | 139 ms
41,276 KB |
testcase_08 | AC | 138 ms
41,408 KB |
testcase_09 | AC | 161 ms
45,488 KB |
testcase_10 | AC | 248 ms
45,780 KB |
testcase_11 | AC | 337 ms
45,728 KB |
testcase_12 | AC | 333 ms
46,136 KB |
ソースコード
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; } }