結果

問題 No.1849 Three Times Value
ユーザー ripityripity
提出日時 2022-02-24 22:47:22
言語 Java21
(openjdk 21)
結果
AC  
実行時間 166 ms / 2,000 ms
コード長 858 bytes
コンパイル時間 2,180 ms
コンパイル使用メモリ 74,540 KB
実行使用メモリ 57,304 KB
最終ジャッジ日時 2023-09-15 10:15:08
合計ジャッジ時間 8,264 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 163 ms
57,180 KB
testcase_01 AC 164 ms
57,272 KB
testcase_02 AC 164 ms
57,272 KB
testcase_03 AC 165 ms
56,720 KB
testcase_04 AC 166 ms
56,572 KB
testcase_05 AC 163 ms
57,304 KB
testcase_06 AC 162 ms
56,828 KB
testcase_07 AC 163 ms
56,672 KB
testcase_08 AC 162 ms
57,032 KB
testcase_09 AC 162 ms
57,096 KB
testcase_10 AC 164 ms
56,896 KB
testcase_11 AC 164 ms
56,812 KB
testcase_12 AC 163 ms
56,456 KB
testcase_13 AC 163 ms
56,700 KB
testcase_14 AC 163 ms
56,980 KB
testcase_15 AC 163 ms
57,032 KB
testcase_16 AC 163 ms
56,588 KB
testcase_17 AC 164 ms
57,084 KB
testcase_18 AC 163 ms
57,112 KB
testcase_19 AC 165 ms
57,100 KB
testcase_20 AC 163 ms
56,900 KB
testcase_21 AC 165 ms
56,680 KB
testcase_22 AC 166 ms
57,004 KB
testcase_23 AC 164 ms
56,900 KB
testcase_24 AC 166 ms
56,924 KB
testcase_25 AC 164 ms
57,040 KB
testcase_26 AC 164 ms
56,744 KB
testcase_27 AC 166 ms
56,752 KB
testcase_28 AC 164 ms
56,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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() {
        
        long N = sc.nextLong();
        long low = 0;
        long high = 100000;
        long mid = 0;
        while( low < high ) {
            mid = (high+low)/2;
            String s = Long.toString(mid);
            long ttv = Long.valueOf(s+s+s);
            if( ttv <= N ) {
                low = mid+1;
            }else {
                high = mid;
            }
        }
        
        pw.println(low-1);
        
    }
    
}
0