| 题目名称 | 1759. [国家集训队 2012] 和与积 |
|---|---|
| 输入输出 | nt2012_calc.in/out |
| 难度等级 | ★★★★ |
| 时间限制 | 1000 ms (1 s) |
| 内存限制 | 256 MiB |
| 测试数据 | 20 |
| 题目来源 |
|
| 开放分组 | 全部用户 |
| 提交状态 | |
| 分类标签 | |
| 分享题解 |
| 通过:11, 提交:28, 通过率:39.29% | ||||
|
|
100 | 0.553 s | 0.75 MiB | C++ |
|
|
100 | 0.559 s | 4.12 MiB | C++ |
|
|
100 | 0.564 s | 0.69 MiB | C++ |
|
|
100 | 0.583 s | 1.14 MiB | C++ |
|
|
100 | 0.596 s | 1.25 MiB | C++ |
|
|
100 | 0.835 s | 8.87 MiB | C++ |
|
|
100 | 0.895 s | 0.53 MiB | C++ |
|
|
100 | 1.836 s | 1.51 MiB | C++ |
|
|
100 | 2.131 s | 1.13 MiB | C++ |
|
|
100 | 2.417 s | 1.24 MiB | C++ |
| 关于 和与积 的近10条评论(全部评论) | ||||
|---|---|---|---|---|
|
只分一次块,复杂度是O(n^(3/4))的吗?
| ||||
|
弱弱的50分暴力。。
#include<iostream> #include<cmath> #include<cstdio> using namespace std; int ans,n; int gcd(int a,int b){return b==0?a:gcd(b,a%b);} int main() { cin>>n; for (int i=1;i<=sqrt(n);i++) for (int j=1;j<=i-1;j++) { if (gcd(i,j)==1) ans+=n/(i*(i+j)); } cout<<ans; }
2015-05-13 19:44
3楼
| ||||
|
太渣了,只会45分暴力。
| ||||
|
萌萌哒的数论题……
| ||||
| Test | N | Test | N |
| 1 | <=10 | 11 | <=5*10^7 |
| 2 | <=50 | 12 | <=10^8 |
| 3 | <=10^3 | 13 | <=2*10^8 |
| 4 | <=5*10^3 | 14 | <=3*10^8 |
| 5 | <=2*10^4 | 15 | <=5*10^8 |
| 6 | <=2*10^5 | 16 | <=10^9 |
| 7 | <=2*10^6 | 17 | <=10^9 |
| 8 | <=10^7 | 18 | <=2^31-1 |
| 9 | <=2*10^7 | 19 | <=2^31-1 |
| 10 | <=3*10^7 | 20 | <=2^31-1 |