結果
| 問題 | No.1185 完全な3の倍数 |
| コンテスト | |
| ユーザー |
RISE70226821
|
| 提出日時 | 2020-08-25 13:10:40 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 821 bytes |
| 記録 | |
| コンパイル時間 | 2,382 ms |
| コンパイル使用メモリ | 74,764 KB |
| 実行使用メモリ | 54,448 KB |
| 最終ジャッジ日時 | 2024-11-06 11:15:56 |
| 合計ジャッジ時間 | 9,432 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 WA * 1 |
ソースコード
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main {
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
// 入力
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
// カウント
int count = 0;
if(N < 100){
count = N / 3 - 3;
}else{
count = 30;
int id = 16;
int num = baseConvert(id) * 3;
while(num <= N){
count++;
id++;
num = baseConvert(id) * 3;
}
}
// 出力
System.out.println(count);
}
// 10進数→4進数変換関数
public static int baseConvert(int num){
int output = 0;
int digit = 1;
while(num > 0){
int amari = num % 4;
output += amari * digit;
num = num / 4;
digit *= 10;
}
return output;
}
}
RISE70226821