竞赛
考级
#include<bits/stdc++.h> using namespace std; int n,a0,a1,b0,b1; int gcdx(int a,int b) { return !b?a:gcdx(b,a%b); } int gcdy(int a,int b)//lcm { return a/gcdx(a,b)b; } int main() { cin>>n; while(n--) { cin>>a0>>a1>>b0>>b1; int m=sqrt(1.0b1),ans=0; for(int i=1;i<=m;i++) { if(b1%i==0) { if(gcdx(i,a0)==a1 and gcdy(i,b0)==b1) { ans++; } if(i!=b1/i and gcdx(b1/i,a0)==a1 and gcdy(b1/i,b0)==b1) { ans++; } } } cout<<ans<<endl; } return 0; }
张晟冉
#include <bits/stdc++.h> using namespace std; int main(void) { int n; scanf("%d", &n); int a[101] = { 0 }; for (int i = 0; i <= n; i++) { scanf("%d", &a[i]); } for (int i = 0; i <= n; i++) { if (a[0] && i == 0 && abs(a[i]) != 1) { printf("%dx^%d", a[i], n); } if (a[0] && i == 0 && abs(a[i]) == 1) { if (a[i] == 1) { printf("x^%d", n); } else { printf("-x^%d", n); } } if (a[i] > 0 && i != n && i != 0 && i != n - 1 && abs(a[i]) != 1) { printf("+%dx^%d", a[i], n - i); } if (a[i] < 0 && i != n&&i!=n-1 && i != 0 && abs(a[i]) != 1) { printf("%dx^%d", a[i], n - i); } if (a[i] && i != n && i != 0 &&i!=n-1&& abs(a[i]) == 1) { if (a[i] == 1) { printf("+x^%d", n - i); } else { printf("-x^%d", n - i); } } if (i == n - 1 && a[i] > 0 && abs(a[i]) != 1) { printf("+%dx"); } if (i == n - 1 && a[i] < 0 && abs(a[i]) != 1) { printf("%dx"); } if (i == n - 1 && abs(a[i]) == 1) { if (a[i] == 1) { printf("+x"); } else { printf("-x"); } } if (i == n && a[i] > 0) { printf("+%d", a[i]); } if (i == n && a[i] < 0) { printf("%d", a[i]); } } return 0; }
#include <cstdio> #include <cstring> #include <iostream> #include <algorithm> using namespace std; const int M = 10005; #define int long long const int inf = 0x3f3f3f3f3f3f3f3f; int read() { int x=0,f=1;char c; while((c=getchar())<'0' || c>'9') {if(c=='-') f=-1;} while(c>='0' && c<='9') {x=(x<<3)+(x<<1)+(c^48);c=getchar();} return xf; } int n,z,a[M],b[M],s[M],dp[2][M55]; void upd(int &x,int y) {x=min(x,y);} signed main() { n=read(); for(int i=1;i<=n;i++) a[i]=read(); for(int i=1;i<n;i++) b[i]=a[i+1]-a[i]; sort(b+1,b+n); for(int i=1;i<n;i++) s[i]=s[i-1]+b[i]; for(z=1;z<n && b[z]==0;z++); memset(dp,0x3f,sizeof dp); dp[(z-1)&1][0]=0; for(int i=z;i<n;i++) { int w=i&1; for(int j=0;j<=a[n]*n;j++) dp[w][j]=inf; for(int j=0;j<=a[n]n;j++) if(dp[w^1][j]<inf) { //head upd(dp[w][j+b[i]i],dp[w^1][j] +2jb[i]+b[i]*b[i]*i); //tail upd(dp[w][j+s[i]],dp[w^1][j]+s[i]s[i]); } } int ans=inf; for(int j=0;j<=a[n]n;j++) if(dp[(n-1)&1][j]<inf) upd(ans,ndp[(n-1)&1][j]-jj); printf("%lld\n",ans); }
#include<iostream> using namespace std; int main(){ cout<<"123"; return 0; }
官方整活了
.Dream.
#include <iostream> using namespace std; int main(){ cout<<"xiaomawang"; return 0; }
#include <iostream> using namespace std; int main(){ double a; cin>>a; cout<<a; return 0; }
#include<bits/stdc++.h> using namespace std; const int N=1010; struct Act{int s,t;}; bool cmp(Act a,Act b){return a.t<b.t;} Act act[N]; int main(){ int n; cin>>n; for(int i=1;i<=n;i++){ cin>>act[i].s>>act[i].t; } sort(act+1,act+1+n,cmp); int cnt=1; int endtime=act[1].t; for(int i=2;i<=n;i++){ if(act[i].s>=endtime){ cnt++; endtime=act[i].t; } } cout<<cnt<<endl; return 0; }
133****8670
https://www.acgo.cn/application/1679000549005918208
靇儱龍壠爖癃龓朧鑨籠礲蘢䡁漋巄䪊
#include<bits/stdc++.h> using namespace std; const int N=300; char st[N]; int si=0,k; string str; int main(){ cin>>str>>k; for(int i=0;i<str.size();i++){ while(si>0&&k>0&&st[si]>str[i]) si--,k--; st[si]=str[i]; } while(k>0){si--;k--;} bool f0=true; for(int i=1;i<=si;i){ if(st[i]=='0'&&f0)continue; else{ f0=false; cout<<st[i]; } } if(f0)cout<<0<<endl; else cout<<endl; return 0; }
https://www.acgo.cn/application/1679077056631783424
吴东润
大家可以在这里讨论C++;
后室探险家
#include<bits/stdc++.h> using namespace std; void move(int n,char a,char c,char b){ if(n==0)return; move(n-1,a,b,c); printf("%c --%d--> %c\n",a,n,c); move(n-1,b,c,a); } int main(){ int n; scanf("%d",&n); move(n,'A','C','B'); return 0; }
我和“聊天群”的小伙伴都在ACGO等你,快用这个专属链接加入我们吧!https://www.acgo.cn/application/1679000549005918208
https://www.acgo.cn/application/1679374859872018432
时间间隙Life
#include<bits/stdc++.h> using namespace std; const int N=1e5+10; int a[N]; long long sum=0; int main(){ int n,x; cin>>n; for(int i=1;i<=n;i++)cin>>a[i]; cin>>x; for(int i=1;i<=x;i++)sum+=a[i]; cout<<sum; return 0; }
https://chat12.aichatos.xyz/#/chat/1689158290176
C++太难了!!!!!
h e l l o w o r l d
沧溟
共10095条