比赛地址:https://ac.nowcoder.com/acm/contest/7610
A:
#include <bits/stdc++.h> using namespace std; int main() { int a,b; scanf("%d:%d",&a,&b); b+=30; if(b>=60) { a+=1; b=b-60; } a+=3; if(a>=24) { a=a-24; } if(a<10) { cout<<"0"<<a; } else { cout<<a; } cout<<":"; if(b<10) { cout<<"0"<<b; } else { cout<<b; } cout<<endl; return 0; }
B:
#include <bits/stdc++.h> using namespace std; int main() { int n; while(cin>>n) { int f=0; for(int i=1;i<=n;i++) { int x; cin>>x; if(x%2==1) { f=1; } } if(f==1) { cout<<"NO"<<endl; } else { cout<<"YES"<<endl; } } return 0; }
C:
#include <bits/stdc++.h> using namespace std; long long gcd(long long a,long long b) { if(b==0) return a; else return gcd(b,a%b); } int main() { long long a,m,b,n; cin>>a>>m>>b>>n; long long zuixiao=a*b*n/gcd(a,b*n); long long ans=0; for(long long i=2;i<=b;i++) { if((a*i)%b!=0&&(a*i)%b-a<0) { ans++; } } cout<<zuixiao/a+zuixiao/b-gcd(a,b)*zuixiao/(a*b)<<endl; return 0; }
笔记:https://ac.nowcoder.com/discuss/548640?type=101&order=0&pos=13&page=1&channel=-1&source_id=1