We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c3735c9 commit 7bfb5b9Copy full SHA for 7bfb5b9
笔试题
@@ -0,0 +1,32 @@
1
+```c++
2
+/*
3
+求区间内两数相乘是平方数的个数
4
+*/
5
+#include <iostream>
6
+#include <bits/stdc++.h>
7
+using namespace std;
8
+const int N= 1e5+233;
9
+bool ok(int n)
10
+{
11
+ int y=(int)sqrt(n);
12
+ if(n==y*y) return true;
13
+ return false;
14
+}
15
+long long vis[N];
16
+int main()
17
18
+ int n,m;
19
+ while(cin>>n>>m)
20
+ {
21
+ n=min(n,m);
22
+ m=max(n,m);
23
+ int ret=n;
24
+ memset(vis,0,sizeof(vis));
25
+ for(int j=2; j<=n; ++j)for(int i=1; i<=(m/n+1); i+=2)vis[(int)pow(j,i)]=1;
26
+ for(int k=n+1; k<=m; ++k)if(ok(k)) vis[k]=1;
27
+ for(int k=n+1; k<=m; ++k) if(vis[k]) ret++;
28
+ cout<<ret<<endl;
29
+ }
30
+ return 0;
31
32
+```
0 commit comments