Codeforces and Polygon may be unavailable from December 6, 19:00 (UTC) to December 6, 21:00 (UTC) due to technical maintenance. ×

Need Help in Prime Checking Problem
Difference between en1 and en2, changed 79 character(s)
Problem source (Traditional Chinese): https://tioj.ck.tp.edu.tw/problems/2073↵

Basically, the problem asks to write a program to check whether the T<=5000 numbers (<=1e9) are prime.↵
Moreover, your program must be in C++ and fits the following format:↵

```cpp↵
#include <cstdio>↵

bool IsPrime(int n) {↵
  int r=1___f_____r__f___f____n___=0__%__f);↵
  return_____4_n__;↵
}↵

int main() {↵
  int x;↵
  while (~scanf("%d", &x)) printf("%d\n", (int)IsPrime(x));↵
}↵
```↵

You can edit each '_' with any character with ASCII code between 32 to 126.↵

I have tried to solve this problem for a long time and couldn't solve it. I have created a "solution", but it only works without  -O2 optimization. Link: https://pastebin.com/K9sCXXn2↵

I desperately wanted to know the solution to this problem. Can somebody drop hints or solutions to this problem? Thanks!

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English gamegame 2018-12-29 04:20:16 79
en1 English gamegame 2018-12-29 04:10:16 818 Initial revision (published)