結果
| 問題 | No.3624 Product |
| コンテスト | |
| ユーザー |
msksknkn
|
| 提出日時 | 2026-08-15 20:47:39 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
AC
|
| 実行時間 | 573 ms / 2,000 ms |
| + 352µs | |
| コード長 | 588 bytes |
| 記録 | |
| コンパイル時間 | 1,412 ms |
| コンパイル使用メモリ | 86,212 KB |
| 実行使用メモリ | 61,296 KB |
| 最終ジャッジ日時 | 2026-08-15 20:47:48 |
| 合計ジャッジ時間 | 6,918 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 12 |
ソースコード
package no3642;
import java.util.*;
public class Main {
public static void main(String[] args) {
// TODO 自動生成されたメソッド・スタブ
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
StringBuilder sb = new StringBuilder();
while(t > 0) {
t--;
int l = sc.nextInt();
int r = sc.nextInt();
if(r == 0) {
sb.append(0 +"\n");
continue;
}
long v = 1;
while(v * 2L <= r) {
v *= 2L;
}if((l & v) != 0) {
sb.append(-1 + "\n");
continue;
}sb.append((long)v * (long)(v - 1) + "\n");
}System.out.print(sb);
}
}
msksknkn