cf
Codeforces Round #395 (Div. 2)
最近忘了写,直接扔代码好了
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
#include<map> #include<set> #include<cmath> #include<queue> #include<stack> #include<vector> #include<cstdio> #include<cassert> #include<iomanip> #include<cstdlib> #include<cstring> #include<iostream> #include<algorithm> #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=2000+10,maxn=500+100,inf=0x3f3f3f; int main() { ios::sync_with_stdio(false); cin.tie(0); int n,m,z; cin>>n>>m>>z; int ans=0; for(int i=1;i<=z;i++) { if(i%n==0&&i%m==0) ans++; } cout<<ans<<endl; return 0; } /********************* *********************/
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
#include<map> #include<set> #include<cmath> #include<queue> #include<stack> #include<vector> #include<cstdio> #include<cassert> #include<iomanip> #include<cstdlib> #include<cstring> #include<iostream> #include<algorithm> #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=200000+10,maxn=500+100,inf=0x3f3f3f; int a[N]; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin>>n; for(int i=1;i<=n;i++)cin>>a[i]; for(int i=1;i<=n/2;i+=2) swap(a[i],a[n-i+1]); for(int i=1;i<=n;i++) cout<<a[i]<<" "; cout<<endl; return 0; } /********************* *********************/
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
#include<map> #include<set> #include<cmath> #include<queue> #include<stack> #include<vector> #include<cstdio> #include<cassert> #include<iomanip> #include<cstdlib> #include<cstring> #include<iostream> #include<algorithm> #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 c[N],p[N],o[N],cnt[N]; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin>>n; for(int i=1;i<n;i++)cin>>p[i]>>o[i]; for(int i=1;i<=n;i++)cin>>c[i]; int sum=0; for(int i=1;i<n;i++) if(c[p[i]]!=c[o[i]]) sum++,cnt[p[i]]++,cnt[o[i]]++; for(int i=1;i<=n;i++) if(sum==cnt[i]) { cout<<"YES"<<endl<<i<<endl; return 0; } cout<<"NO"<<endl; return 0; } /********************* 4 1 2 2 3 2 4 1 1 2 1 *********************/