File tree 4 files changed +73
-10
lines changed
4 files changed +73
-10
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ // Use IntelliSense to learn about possible attributes.
3
+ // Hover to view descriptions of existing attributes.
4
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
+ "version" : " 0.2.0" ,
6
+ "configurations" : [
7
+ {
8
+ "name" : " g++.exe - Build and debug active file" ,
9
+ "type" : " cppdbg" ,
10
+ "request" : " launch" ,
11
+ "program" : " ${fileDirname}\\ ${fileBasenameNoExtension}.exe" ,
12
+ "args" : [],
13
+ "stopAtEntry" : false ,
14
+ "cwd" : " ${workspaceFolder}" ,
15
+ "environment" : [],
16
+ "externalConsole" : false ,
17
+ "MIMode" : " gdb" ,
18
+ "miDebuggerPath" : " C:\\ MinGW\\ bin\\ gdb.exe" ,
19
+ "setupCommands" : [
20
+ {
21
+ "description" : " Enable pretty-printing for gdb" ,
22
+ "text" : " -enable-pretty-printing" ,
23
+ "ignoreFailures" : true
24
+ }
25
+ ],
26
+ "preLaunchTask" : " C/C++: g++.exe build active file"
27
+ }
28
+ ]
29
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "tasks" : [
3
+ {
4
+ "type" : " shell" ,
5
+ "label" : " C/C++: g++.exe build active file" ,
6
+ "command" : " C:\\ MinGW\\ bin\\ g++.exe" ,
7
+ "args" : [
8
+ " -g" ,
9
+ " ${file}" ,
10
+ " -o" ,
11
+ " ${fileDirname}\\ ${fileBasenameNoExtension}.exe"
12
+ ],
13
+ "options" : {
14
+ "cwd" : " ${workspaceFolder}"
15
+ },
16
+ "problemMatcher" : [
17
+ " $gcc"
18
+ ],
19
+ "group" : {
20
+ "kind" : " build" ,
21
+ "isDefault" : true
22
+ }
23
+ }
24
+ ],
25
+ "version" : " 2.0.0"
26
+ }
Original file line number Diff line number Diff line change @@ -3,21 +3,29 @@ using namespace std;
3
3
4
4
int main ()
5
5
{
6
+ ios_base::sync_with_stdio (false );
7
+ cin.tie (NULL );
8
+ cout.tie (NULL );
9
+
6
10
int n;
7
11
cin>>n;
8
- int d=2 ;
9
12
bool divided=false ;
10
- while (d<n)
11
- {
12
- if (n%d==0 )
13
- {
14
- cout<<" False" <<endl;
15
- divided=true ;
13
+ if (n%2 ==0 ){
14
+ divided=true ;
15
+ }
16
+ else {
17
+ int d=3 ;
18
+ while (d*d<n){
19
+ if (n%d==0 ){
20
+ divided=true ;
21
+ break ;
22
+ }
23
+ d+=2 ;
16
24
}
17
- d++;
18
25
}
19
- if (!divided)
20
- {
26
+ if (!divided){
21
27
cout<<" True" <<endl;
28
+ }else {
29
+ cout<<" False" <<endl;
22
30
}
23
31
}
You can’t perform that action at this time.
0 commit comments