Submission #20534927


Source Code Expand

Copy
import std.conv, std.functional, std.range, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.bitmanip, std.complex, std.container, std.math, std.mathspecial, std.numeric, std.regex, std.typecons;
import core.bitop;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; }
int readInt() { return readToken.to!int; }
long readLong() { return readToken.to!long; }
real readReal() { return readToken.to!real; }

bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } }
bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } }

int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; }
int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); }
int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); }




void main() {
  try {
    for (; ; ) {
      const N = readLong();
      
      long[] xs;
      for (long a = 2; a^^2 <= N; ++a) {
        long aa = a^^2;
        for (; aa <= N; aa *= a) {
          xs ~= aa;
        }
      }
      xs = xs.sort.uniq.array;
      const ans = N - cast(int)(xs.length);
      writeln(ans);
    }
  } catch (EOFException e) {
  }
}

Submission Info

Submission Time
Task C - Unexpressed
User hos_lyric
Language D (LDC 1.20.1)
Score 300
Code Size 1579 Byte
Status AC
Exec Time 16 ms
Memory 4800 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 61
Set Name Test Cases
Sample 01_sample.txt, 02_sample.txt
All 01_sample.txt, 02_sample.txt, 10000000000_hand.txt, 10077695_pow.txt, 106830803_exp.txt, 1149_exp.txt, 1162261467_pow.txt, 125_hand.txt, 126_pow.txt, 129_pow.txt, 1341805554_exp.txt, 1468_exp.txt, 14_exp.txt, 15626_pow.txt, 167508771_exp.txt, 1697162_exp.txt, 177_exp.txt, 1920_exp.txt, 1977326742_pow.txt, 1997691865_exp.txt, 1_hand.txt, 2121516983_exp.txt, 21378622_exp.txt, 216_pow.txt, 233694_exp.txt, 2380105_exp.txt, 244140625_pow.txt, 2487595879_exp.txt, 2628894325_large.txt, 280262884_exp.txt, 3125_pow.txt, 31_exp.txt, 38114099_exp.txt, 4137_exp.txt, 41952318_exp.txt, 4971407775_large.txt, 49_pow.txt, 4_exp.txt, 50157498_exp.txt, 512_pow.txt, 5202647942_large.txt, 531441_pow.txt, 53_exp.txt, 5645468307_large.txt, 5669240390_large.txt, 609062_exp.txt, 6983776800_hand.txt, 728_pow.txt, 72977005_exp.txt, 729_pow.txt, 78126_pow.txt, 8002087506_large.txt, 8192_pow.txt, 84_exp.txt, 8731963982_large.txt, 909_exp.txt, 917490542_exp.txt, 919385315_exp.txt, 939887597_large.txt, 971207868_large.txt, 9_exp.txt
Case Name Status Exec Time Memory
01_sample.txt AC 10 ms 3384 KB
02_sample.txt AC 3 ms 3240 KB
10000000000_hand.txt AC 16 ms 4800 KB
10077695_pow.txt AC 3 ms 3116 KB
106830803_exp.txt AC 4 ms 3320 KB
1149_exp.txt AC 3 ms 3300 KB
1162261467_pow.txt AC 6 ms 3660 KB
125_hand.txt AC 3 ms 3328 KB
126_pow.txt AC 4 ms 3172 KB
129_pow.txt AC 3 ms 3328 KB
1341805554_exp.txt AC 9 ms 3512 KB
1468_exp.txt AC 3 ms 3192 KB
14_exp.txt AC 3 ms 3340 KB
15626_pow.txt AC 3 ms 3288 KB
167508771_exp.txt AC 4 ms 3304 KB
1697162_exp.txt AC 3 ms 3236 KB
177_exp.txt AC 3 ms 3192 KB
1920_exp.txt AC 7 ms 3224 KB
1977326742_pow.txt AC 8 ms 3592 KB
1997691865_exp.txt AC 9 ms 3588 KB
1_hand.txt AC 3 ms 3388 KB
2121516983_exp.txt AC 7 ms 3620 KB
21378622_exp.txt AC 4 ms 3400 KB
216_pow.txt AC 3 ms 3384 KB
233694_exp.txt AC 3 ms 3380 KB
2380105_exp.txt AC 4 ms 3200 KB
244140625_pow.txt AC 6 ms 3248 KB
2487595879_exp.txt AC 9 ms 3860 KB
2628894325_large.txt AC 14 ms 4028 KB
280262884_exp.txt AC 7 ms 3324 KB
3125_pow.txt AC 4 ms 3112 KB
31_exp.txt AC 3 ms 3300 KB
38114099_exp.txt AC 4 ms 3116 KB
4137_exp.txt AC 4 ms 3304 KB
41952318_exp.txt AC 4 ms 3236 KB
4971407775_large.txt AC 12 ms 4000 KB
49_pow.txt AC 4 ms 3396 KB
4_exp.txt AC 3 ms 3192 KB
50157498_exp.txt AC 4 ms 3292 KB
512_pow.txt AC 3 ms 3292 KB
5202647942_large.txt AC 7 ms 4148 KB
531441_pow.txt AC 3 ms 3240 KB
53_exp.txt AC 3 ms 3376 KB
5645468307_large.txt AC 14 ms 4036 KB
5669240390_large.txt AC 13 ms 4088 KB
609062_exp.txt AC 4 ms 3332 KB
6983776800_hand.txt AC 16 ms 4536 KB
728_pow.txt AC 3 ms 3284 KB
72977005_exp.txt AC 4 ms 3116 KB
729_pow.txt AC 3 ms 3164 KB
78126_pow.txt AC 4 ms 3352 KB
8002087506_large.txt AC 14 ms 4396 KB
8192_pow.txt AC 3 ms 3380 KB
84_exp.txt AC 3 ms 3400 KB
8731963982_large.txt AC 15 ms 4356 KB
909_exp.txt AC 3 ms 3400 KB
917490542_exp.txt AC 4 ms 3612 KB
919385315_exp.txt AC 7 ms 3468 KB
939887597_large.txt AC 8 ms 3660 KB
971207868_large.txt AC 6 ms 3504 KB
9_exp.txt AC 3 ms 3288 KB