結果
問題 |
No.1860 Magnets
|
ユーザー |
![]() |
提出日時 | 2022-03-04 21:30:15 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 132 ms / 2,000 ms |
コード長 | 837 bytes |
コンパイル時間 | 2,011 ms |
コンパイル使用メモリ | 74,108 KB |
実行使用メモリ | 41,456 KB |
最終ジャッジ日時 | 2024-07-18 19:28:40 |
合計ジャッジ時間 | 6,491 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 28 |
ソースコード
import java.util.*; import java.io.*; public class Main { public static Scanner sc = new Scanner(System.in); public static PrintWriter pw = new PrintWriter(System.out); public static void main(String[] args) { int t = 1; while( t > 0 ) { solve(); t--; } pw.flush(); } static void solve() { int A = sc.nextInt(); int B = sc.nextInt(); int ans = 0; if( A == B ) { ans += 2*A; }else { if( A > B ) { int temp = A; A = B; B = temp; } ans += 2*A+1; B -= A+1; A = 0; ans += 2*B; } pw.println(ans); } }