题目网址

https://vjudge.net/contest/299443#problem (复制到谷歌浏览器打开)

A题

#include <bits/stdc++.h>
using namespace std;
string a;
int k,tmp,ans;
int main()
{
    while(cin>>a)
    {
        ans=0;
        for(int i=0;i<a.length();i++)
        {
            if(a[i]=='.')
            {k=i-1;break;}
        }
        if(a[k]=='9'){printf("GOTO Vasilisa.\n");continue;}
        else
        {
            for(int i=0;i<=k-1;i++)
                printf("%c",a[i]);
            if(a[k+2]>='5')printf("%c\n",a[k]+1);
            else printf("%c\n",a[k]);
        }
    }
    return 0;
}

B题

#include <bits/stdc++.h>
using namespace std;
int n,s,a1,b1,v1,v2,ave,num1,num2,flag,a[1010];//a1是多的那个酒杯的编号
int main()
{
    ios::sync_with_stdio(false);
    while(cin>>n)
    {
        s=0;
        for(int i=1;i<=n;i++)
        {
            cin>>a[i];
            s=s+a[i];
        }
        ave=s/n;flag=0;num1=num2=0;
        for(int i=1;i<=n;i++)
        {
            if(a[i]!=ave)flag=1;
            if(a[i]>ave){num1++;a1=i;v1=a[i]-ave;}
            if(a[i]<ave){num2++;b1=i;v2=ave-a[i];}
        }
        if(flag==0)printf("Exemplary pages.\n");
        else
        {
            if(num1==1&&num2==1)
            {
                if(v1==v2) printf("%d ml. from cup #%d to cup #%d.\n",v1,b1,a1);
                else printf("Unrecoverable configuration.\n");
            }
            else printf("Unrecoverable configuration.\n");
        }
    }
    return 0;
}

C题

贴的别人的代码...

#include <bits/stdc++.h>
using namespace std;
const int N=2e5+5;
string s;
queue<string> q;
map<string,int> mp;
void bfs(string s)
{
    mp[s]=true;
    q.push(s);
    while(!q.empty())
    {
        string u=q.front(),v1,v2,v3;
        q.pop();
        v1=v2=v3=u;
        v1[0]=u[3],v1[1]=u[0],v1[2]=u[1],v1[3]=u[2];    
        v2[0]=u[4],v2[5]=u[0],v2[2]=u[5],v2[4]=u[2];
        v3[5]=u[1],v3[3]=u[5],v3[4]=u[3],v3[1]=u[4];
        if(!mp[v1]) mp[v1]=true,q.push(v1);
        if(!mp[v2]) mp[v2]=true,q.push(v2);
        if(!mp[v3]) mp[v3]=true,q.push(v3); 
    }
}
int main()
{
    cin>>s;
    int res=0;
    sort(s.begin(),s.end());
    do{
        if(mp[s])   continue;
        res++;
        bfs(s); 
    }while(next_permutation(s.begin(),s.end()));
    cout<<res<<'\n';
    return 0;
}

D\E题 未完待续。。。