AtCoder Beginner Contest 221
本文最后更新于 1028 天前,其中的信息可能已经有所发展或是发生改变。
//A.cpp

#include<bits/stdc++.h>
using namespace std;

inline int read(){
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9')
        if(ch=='-') f=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*f;
}

int a,b;

int main(){
    cin>>a>>b;
    long long ans=1;
    for(int i=1;i<=max(a,b)-min(a,b);i++){
        ans*=32;
    }
    cout<<ans<<endl;
    
}
//B.cpp

#include<bits/stdc++.h>
using namespace std;

inline int read(){
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9')
        if(ch=='-') f=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*f;
}

string a,b;

int main(){
    cin>>a>>b;
    if(a==b){
        cout<<"Yes"<<endl;
        return 0;
    }
    for(int i=0;i<a.size();i++){
        swap(a[i],a[i+1]);
        if(a==b){
            cout<<"Yes"<<endl;
            return 0;
        }
        swap(a[i],a[i+1]);
    }
    cout<<"No"<<endl;
}
//C.cpp

#include<bits/stdc++.h>
using namespace std;

inline int read(){
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9')
        if(ch=='-') f=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*f;
}

int n;
long long ans;
bool st[12];
int size1=0;

void dfs(int now){
    priority_queue<int>a;
    for(int i=1;i<=size1;i++){
        int tmp=n;
        for(int j=1;j<=i-1;j++)
            tmp/=10;
        tmp%=10;
        if(st[i]==0) a.push(tmp);
    }
    int buf=0;
    while(!a.empty()){
        buf=buf*10+a.top();
        a.pop();
    }
    ans=max(1ll*now*buf,ans);
    //cout<<"Now we have "<<now<<" * "<<buf<<" ans= "<<1ll*now*buf<<endl;
    for(int i=1;i<=size1;i++){
        if(!st[i]){
            int tmp=n;
            for(int j=1;j<=i-1;j++)
                tmp/=10;
            tmp%=10;
            st[i]=1;
            dfs(now*10+tmp);
            st[i]=0;
        }
    }
}

int main(){
    n=read();
    int qaq=n;
    while(qaq){qaq/=10;size1++;}
    //cout<<size1<<endl;
    for(int i=1;i<=size1;i++){
        int tmp=n;
        for(int j=1;j<=i-1;j++)
            tmp/=10;
        st[i]=1;
        dfs(tmp%10);
        st[i]=0;
    }
    cout<<ans<<endl;
}
//D.cpp

#include<bits/stdc++.h>
using namespace std;

inline int read(){
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9')
        if(ch=='-') f=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*f;
}

const int N=4e5+5;

struct point{
    int type;
    int p;
}p[N];

bool cmp(point x,point y){
  return x.p<y.p;
}

int cnt,n;
int num;
int ans[N];
int last;
int lastnum;
int tot;
int pre[N];
int she[N];
int main(){
    n=read();
    for(int i=1;i<=n;i++){
        int a=read();
        int b=read();
        p[++cnt].p=a;
        p[cnt].type=1;
        p[++cnt].p=a+b;
        p[cnt].type=-1;
    }
    sort(p+1,p+1+cnt,cmp);
    for(int i=1;i<=cnt;i++){
        // if(p[i].p!=p[i-1].p){
        //     tot++;
        //     if(p[i].type==1)
        //         pre[tot]++;
        //     if(p[i].type==2)
        //         pre[tot]--;
        //     she[tot]=p[i].p;
        // }
        // else {
        //     if(p[i].type==1)
        //         pre[tot]++;
        //     if(p[i].type==2)
        //         pre[tot]--;
        // }
        
            num+=p[i-1].type;
            ans[num]+=p[i].p-p[i-1].p;
        
    }
    // for(int i=1;i<=tot;i++){
    //     num+=pre[i];
    //     ans[num]+=she[i]-she[i-1];
    // }
    for(int i=1;i<=n;i++){
        cout<<ans[i]<<" ";
    }
    cout<<endl;
    return 0;
}
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇