码迷,mamicode.com
首页 > 其他好文 > 详细

2.2测试赛AC代码临时保存

时间:2020-02-02 21:23:53      阅读:63      评论:0      收藏:0      [点我收藏+]

标签:can   code   clu   c代码   pow   wap   i++   include   abs   

//A
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<cmath>

using namespace std;

int main()
{
    int x,y,t;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d %d",&x,&y);
        long long int z = 6 * pow(2,x+2) * y;
        long long int pt = z;
        if(z%100 != 0)
        {
            pt = (z / 100 + 1) * 100;
        }
        if((x==3 && y>=70) || (x==4 && y>=40) || (x==5)) pt = 12000;
        else if(x==6 || x==7) pt = 18000;
        else if(x>=8 && x<=10) pt = 24000;
        else if(x>=11 && x<=12) pt = 36000;
        else if(x>=13) pt = 48000;
        printf("%lld\n",pt);
    }
    return 0;
}
//B
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cstring>

using namespace std;

int num[100010],book[100010];

int main()
{
    int n,cnt=0;
    long long sum = 0;
    scanf("%d",&n);
    for(int i=0; i<n; i++) scanf("%d",&num[i]);
    book[0] = 1;
    for(int i=1; i<n; i++)
    {
        if(num[i]>num[i-1]) book[i] = book[i-1] + 1;
        else book[i] = 1;
    }
    for(int i=n-2; i>=0; i--)
    {
        if(num[i]>num[i+1] && book[i]<=book[i+1]) book[i] = book[i+1] + 1;
    }
    for(int i=0; i<n; i++) sum += book[i];
    printf("%lld\n",sum);
    return 0;
}
//J
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cstring>

using namespace std;

bool InYuan(int r,int a,int b,int x,int y)
{
    return ((x-a)*(x-a) + (y-b)*(y-b) <= r*r);
}

bool InJu(int x1,int x2,int y1,int y2,int x,int y)
{
    return (x<=x2 && x>=x1 && y>=y1 && y<=y2);
}

int main()
{
    int w,h,xc,yc,r,x1,y1,x2,y2;
    scanf("%d %d %d %d %d %d %d %d %d",&w,&h,&xc,&yc,&r,&x1,&y1,&x2,&y2);
    if(x1 == x2)
    {
        int l = abs(y1 - y2);
        if(y2 > y1) x2 += l;
        else if(y1 > y2) x1 -= l;
    }
    else if(y1 == y2)
    {
        int l = abs(x1 - x2);
        if(x2 > x1) y1 -= l;
        else if(x1 > x2) y2 += l;
    }
    if(x1 > x2) swap(x1,x2);
    if(y1 > y2) swap(y1,y2);
    for(int i=0; i<w; i++)
    {
        for(int j=0; j<h; j++)
        {
            if(InYuan(r,xc,yc,i,j) || InJu(x1,x2,y1,y2,i,j))
            {
                printf("/");
            }
            else 
            {
                printf("\\");
            }
        }
        printf("\n");
    }
    return 0;
}

2.2测试赛AC代码临时保存

标签:can   code   clu   c代码   pow   wap   i++   include   abs   

原文地址:https://www.cnblogs.com/sdutzxr/p/12253528.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!