打表太长,洛谷显示代码过长怎么办

P3912 素数个数

你不会筛啊
by memset0 @ 2018-10-13 23:06:58


就是懒
by memset0 @ 2018-10-13 23:07:03


很好办,写正经代码
by DR安 @ 2018-10-13 23:09:01


爆搜挂着机,打表出省一
by LinAPro @ 2018-10-13 23:09:38


普通代码TLE: ```cpp #include<bits/stdc++.h> using namespace std; bool zs(int n) { if(n==1 || n==0) return false; for(int i=2;i<=sqrt(n);i++) if(n%i==0) return false; return true; } int main() { int n,s=0; cin>>n; for(int i=1;i<=n;i++) if(zs(i)==true) s++; cout<<s; return 0; } ```
by 吴宪兴 @ 2018-10-13 23:12:06


@[Ancient_One](/space/show?uid=52210) 正经代码怎么写
by 星之海 @ 2018-10-13 23:16:39


@[memset0](/space/show?uid=53495) 我会打表不会筛
by 星之海 @ 2018-10-13 23:17:09


@[胖_few](/space/show?uid=51135) 不会就去学呗
by memset0 @ 2018-10-13 23:18:04


@[胖_few](/space/show?uid=51135) 骗 AC 有什么用
by memset0 @ 2018-10-13 23:18:15


@[memset0](/space/show?uid=53495) 骗也是一种技术
by 星之海 @ 2018-10-13 23:19:16


| 下一页