本文共 3777 字,大约阅读时间需要 12 分钟。
这是一场爆0的比赛。。。。。。
第一题wa了20发,longlong改double再改unsigned long long还是wa,最后判断的时候改成除,边界设为1e19就过了
#include#include #include #include #include #include #include #include #include #include #include #include #include #define pi acos(-1.0)#define ll long long#define mod 1000000007#define ls l,m,rt<<1#define rs m+1,r,rt<<1|1#pragma comment(linker, "/STACK:1024000000,1024000000")using namespace std;const double g=10.0,eps=1e-12;const int N=100000+10,maxn=500+100,inf=0x3f3f3f;int main(){ ios::sync_with_stdio(false); cin.tie(0); cout< < >l>>r>>k; bool f=0; for(int i=0;;i++) { // cout< < =l&&s<=r) { cout< <<" "; f=1; } if(1e19/s
A题python写超级简单= =
l,r,k=input().strip().split()s = 1s = int(s)l = int(l)r = int(r)k = int(k)f = 0for i in range(1000): if s>=l and s<=r: f = 1 print(s) elif s>r: break s*=kif f == 0: print(-1)
B正常直接相乘肯定t掉,转化成字符串记录0的个数
#include#include #include #include #include #include #include #include #include #include #include #include #include #define pi acos(-1.0)#define ll long long#define mod 1000000007#define ls l,m,rt<<1#define rs m+1,r,rt<<1|1#pragma comment(linker, "/STACK:1024000000,1024000000")using namespace std;const double g=10.0,eps=1e-12;const int N=100000+10,maxn=500+100,inf=0x3f3f3f;int main(){ ios::sync_with_stdio(false); cin.tie(0); int n,zero=0; cin>>n; bool mulzero=0; string ans="1"; for(int i=0;i >s; if(s.size()==1&&s[0]=='0') { mulzero=1; continue; } bool ok=1; for(int j=0;j
C计算几何,先扫点记录最大距离,再扫边记录最小距离(先判断点到边能不能直接计算最短距离)
#include#include #include #include #include #include #include #include #include #include #include #include #include #define pi acos(-1.0)#define ll long long#define mod 1000000007#define ls l,m,rt<<1#define rs m+1,r,rt<<1|1#pragma comment(linker, "/STACK:1024000000,1024000000")using namespace std;const double g=10.0,eps=1e-12;const int N=100000+10,maxn=500+100,inf=0x3f3f3f;struct point{ double x,y; point(){} point(double _x,double _y):x(_x),y(_y){}}p[N];double dis(point p1,point p2){ return sqrt((p2.x-p1.x)*(p2.x-p1.x)+(p2.y-p1.y)*(p2.y-p1.y));}double linedis(point p1,point p2,point p3){ double a1=p3.y-p2.y,b1=-(p3.x-p2.x),c1=-p3.x*(p3.y-p2.y)+p3.y*(p3.x-p2.x); double a2=p3.x-p2.x,b2=p3.y-p2.y,c2=-p1.x*(p3.x-p2.x)-p1.y*(p3.y-p2.y); double x,y; if(a1==0&&a2!=0) { y=-c1/b1,x=(-b2*y-c2)/a2; } else if(a1!=0&&a2==0) { y=-c2/b2,x=(-b1*y-c1)/a1; } else { x=(b1*c2-b2*c1)/(b2*a1-b1*a2); if(b1==0)y=(-a2*x-c2)/b2; else y=(-a1*x-c1)/b1; } /* cout< <<" "< <<" "< < >n>>o.x>>o.y; for(int i=0;i >p[i].x>>p[i].y; p[n]=p[0]; double minn=1e7,maxx=0; for(int i=0;i
E题gcd,先看颜色奇数有多少个,奇数大于1就是输出0,否则就是gcd,然后输出的时候交替输出
#include#include #include #include #include #include #include #include #include #include #include #include #include #define C 0.5772156649#define pi acos(-1.0)#define ll long long#define mod 1000000007#define ls l,m,rt<<1#define rs m+1,r,rt<<1|1#pragma comment(linker, "/STACK:1024000000,1024000000")using namespace std;const double g=10.0,eps=1e-7;const int N=2000+10,maxn=500+100,inf=0x3f3f3f;int color[30];inline int gcd(int a,int b){ return b?gcd(b,a%b):a;}int main(){ ios::sync_with_stdio(false); cin.tie(0); int n,x=0; cin>>n; for(int i=0;i >color[i]; x=gcd(x,color[i]); } int s=0; for(int i=0; i 1) { cout<<0< =0;i--) for(int j=0;j
转载于:https://www.cnblogs.com/acjiumeng/p/7219405.html