2016ACM/ICPC亚洲区青岛站 ABC题题解

A

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;


int main()
{

    int  t;
    scanf("%d",&t);
    while(t--){
        int n;
        int sum = 0;
        int a,b;
        scanf("%d",&n);
        for(int i=0;i<n;++i){
            scanf("%d%d",&a,&b);
            sum+=a*b;
        }
        printf("%d\n",sum);
        
    }
    return 0;
}

B
模拟一下
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

int s[7][5];
int t[7][5];

bool check(){
    int f =1;
    for(int i= 1;i<=6;++i){
        if(!(t[i][1]==t[i][2] && t[i][2]==t[i][3] && t[i][3]==t[i][4])){
            f = 0;
            break;
        }
    }
    if(f) return true;
    else return false;
}

int main()
{

    int  tt;
    scanf("%d",&tt);
    while(tt--){
        for(int i = 1;i<=6;++i){
            for(int j = 1;j<=4;++j)
                scanf("%d",&s[i][j]);
        }

        ///复原
        for(int i = 1;i<=6;++i){
            for(int j = 1;j<=4;++j)
                t[i][j] = s[i][j];
        }
        if(check()){
            printf("YES\n");
            continue;
        }
        ///上面的左转
        t[2][1] = s[6][3];
        t[2][2] = s[6][1];
        t[5][2] = s[2][1];
        t[5][4] = s[2][2];
        t[4][4] = s[5][2];
        t[4][3] = s[5][4];
        t[6][3] = s[4][4];
        t[6][1] = s[4][3];
        if(check()){
            printf("YES\n");
            continue;
        }
        ///上面的右转
        t[2][2] = s[5][4];
        t[2][1] = s[5][2];
        t[5][4] = s[4][3];
        t[5][2] = s[4][4];
        t[4][3] = s[6][1];
        t[4][4] = s[6][3];
        t[6][1] = s[2][2];
        t[6][3] = s[2][1];
        if(check()){
            printf("YES\n");
            continue;
        }



        ///复原
        for(int i = 1;i<=6;++i){
            for(int j = 1;j<=4;++j)
                t[i][j] = s[i][j];
        }
        ///右边的上转
        t[1][2] = s[2][2];
        t[1][4] = s[2][4];
        t[2][2] = s[3][2];
        t[2][4] = s[3][4];
        t[3][2] = s[4][2];
        t[3][4] = s[4][4];
        t[4][2] = s[1][2];
        t[4][4] = s[1][4];
        if(check()){
            printf("YES\n");
            continue;
        }
        ///右边下转
        t[2][2] = s[1][2];
        t[2][4] = s[1][4];
        t[1][2] = s[4][2];
        t[1][4] = s[4][4];
        t[4][2] = s[3][2];
        t[4][4] = s[3][4];
        t[3][2] = s[2][2];
        t[3][4] = s[2][4];
        if(check()){
            printf("YES\n");
            continue;
        }



         ///复原
        for(int i = 1;i<=6;++i){
            for(int j = 1;j<=4;++j)
                t[i][j] = s[i][j];
        }
        ///前面左传
        t[1][3] = s[6][3];
        t[1][4] = s[6][4];
        t[6][3] = s[3][2];
        t[6][4] = s[3][1];
        t[3][2] = s[5][3];
        t[3][1] = s[5][4];
        t[5][3] = s[1][3];
        t[5][4] = s[1][4];
        if(check()){
            printf("YES\n");
            continue;
        }
        ///前面右传
        t[1][3] = s[5][3];
        t[1][4] = s[5][4];
        t[6][3] = s[1][3];
        t[6][4] = s[1][4];
        t[3][2] = s[6][3];
        t[3][1] = s[6][4];
        t[5][3] = s[3][2];
        t[5][4] = s[3][1];
        if(check()){
            printf("YES\n");
            continue;
        }
        printf("NO\n");
    }
    return 0;
}
C
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;


int main()
{

    int  t;
    scanf("%d",&t);
    while(t--){
        double a=0,b=0;
        scanf("%lf%lf",&a,&b);
        if(a<=b)
            printf("0.000000\n");
        else{
            printf("%.6I64f\n",log(a/b)+1);
        }
    }
    return 0;
}



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值