Created
November 3, 2022 01:25
-
-
Save Caesar-Victory/24f62f9b03b660f683c4bab4ea4ccacf to your computer and use it in GitHub Desktop.
#C++
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
const int N = 100010; | |
int main(void) { | |
for (int i = 100000;; i++) { | |
bool flag = true; | |
// 排除1作为质数 | |
for (int j = 2; j * j <= i; j++) { | |
// 取模是只能被自身整除 | |
if (i % j == 0) { | |
flag = false; | |
break; | |
} | |
} | |
if (flag) { | |
cout << i << endl; | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment