結果

問題 No.537 ユーザーID
ユーザー Shun_PIShun_PI
提出日時 2017-06-30 22:50:48
言語 Java21
(openjdk 21)
結果
AC  
実行時間 164 ms / 2,000 ms
コード長 2,372 bytes
コンパイル時間 2,955 ms
コンパイル使用メモリ 80,556 KB
実行使用メモリ 54,688 KB
最終ジャッジ日時 2024-04-15 06:49:35
合計ジャッジ時間 6,464 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
50,272 KB
testcase_01 AC 59 ms
50,188 KB
testcase_02 AC 61 ms
50,016 KB
testcase_03 AC 62 ms
50,220 KB
testcase_04 AC 62 ms
50,216 KB
testcase_05 AC 60 ms
50,176 KB
testcase_06 AC 61 ms
50,072 KB
testcase_07 AC 61 ms
50,324 KB
testcase_08 AC 63 ms
50,180 KB
testcase_09 AC 65 ms
50,304 KB
testcase_10 AC 63 ms
50,312 KB
testcase_11 AC 61 ms
50,292 KB
testcase_12 AC 62 ms
50,036 KB
testcase_13 AC 62 ms
50,304 KB
testcase_14 AC 62 ms
49,856 KB
testcase_15 AC 63 ms
50,408 KB
testcase_16 AC 62 ms
50,120 KB
testcase_17 AC 63 ms
50,236 KB
testcase_18 AC 92 ms
51,860 KB
testcase_19 AC 88 ms
51,504 KB
testcase_20 AC 87 ms
51,312 KB
testcase_21 AC 88 ms
51,756 KB
testcase_22 AC 91 ms
51,416 KB
testcase_23 AC 99 ms
51,940 KB
testcase_24 AC 71 ms
51,124 KB
testcase_25 AC 100 ms
51,824 KB
testcase_26 AC 100 ms
51,540 KB
testcase_27 AC 106 ms
51,768 KB
testcase_28 AC 136 ms
52,444 KB
testcase_29 AC 164 ms
54,644 KB
testcase_30 AC 150 ms
54,688 KB
testcase_31 AC 88 ms
51,184 KB
testcase_32 AC 86 ms
50,936 KB
testcase_33 AC 136 ms
52,088 KB
testcase_34 AC 102 ms
51,848 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.IOException;
import java.io.InputStream;
import java.util.HashSet;
import java.util.NoSuchElementException;
 
public class Main {
	private static FastScanner sc = new FastScanner();
	
	public static void main(String[] args) {
		long N = sc.nextLong();
		
		HashSet<Long> set = new HashSet<>();
		for(long i=1; i*i<=N; i++) {
			if(N % i == 0) {
				set.add(i);
			}
		}
		
		HashSet<Long> set2 = new HashSet<>();
		set2.addAll(set);
		for(long num : set) {
			if(!set2.contains(N/num)) {
				set2.add(N/num);
			}
		}
		HashSet<String> sset = new HashSet<>();
		for(long num : set2) {
			String s = String.valueOf(num) + String.valueOf(N/num);
			if(!sset.contains(s)) {
				sset.add(s);
			}
		}
		
		System.out.println(sset.size());
	}
	
	static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if(ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch(IOException e) {
                    e.printStackTrace();
                }
                if(buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int nextInt(){
            return Integer.parseInt(next());
        }
        public double nextDouble(){
            return Double.parseDouble(next());
        }
    }
}
0