首页 > 代码库 > 暑假集训cf50练之19

暑假集训cf50练之19

Codeforces Round #388 (Div. 2)

A水,总是忘记输出个数

技术分享
#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 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=35000+10,maxn=500+100,inf=0x3f3f3f;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    vector<int>v;
    if(n&1)
    {
        v.push_back(3);
        n-=3;
    }
    while(n>0)
    {
        v.push_back(2);
        n-=2;
    }
    cout<<v.size()<<endl;
    for(int i=0;i<v.size();i++)
        cout<<v[i]<<" ";
    cout<<endl;
    return 0;
}
/********************

********************/
A

B平行四边形,一定是三个点

技术分享
#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 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=35000+10,maxn=500+100,inf=0x3f3f3f;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int x[3],y[3];
    for(int i=0;i<3;i++)
        cin>>x[i]>>y[i];
    cout<<3<<endl;
    cout<<x[0]+x[2]-x[1]<<" "<<y[0]+y[2]-y[1]<<endl;
    cout<<x[0]-x[2]+x[1]<<" "<<y[0]-y[2]+y[1]<<endl;
    cout<<x[1]+x[2]-x[0]<<" "<<y[1]+y[2]-y[0]<<endl;
    return 0;
}
/********************

********************/
B

C两个队列维护进去的时间,判断哪个时间大,就pop那个,时间小的加到队列尾,时间+n

技术分享
#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 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=35000+10,maxn=500+100,inf=0x3f3f3f;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int x[3],y[3];
    for(int i=0;i<3;i++)
        cin>>x[i]>>y[i];
    cout<<3<<endl;
    cout<<x[0]+x[2]-x[1]<<" "<<y[0]+y[2]-y[1]<<endl;
    cout<<x[0]-x[2]+x[1]<<" "<<y[0]-y[2]+y[1]<<endl;
    cout<<x[1]+x[2]-x[0]<<" "<<y[1]+y[2]-y[0]<<endl;
    return 0;
}
/********************

********************/
C

 

暑假集训cf50练之19