Codeforces Round #460 (Div. 2) 【A B C】【水】【暴力】

                            传送门

A

#include<bits/stdc++.h>
using namespace std;
int main(int argc,char *argv[])
{
    int n, m;
    cin >> n >> m;
    double minn = 0x3f3f3f3f;
    for(int i = 0; i < n; i++)
    {
        double a, b;
        cin >> a >> b;
        minn = min(minn, a / b);
    }
    printf("%.8f\n", minn * m);
    return 0;
}
B
#include<bits/stdc++.h>
using namespace std;
int a[10005];

int main()
{
    int num = 0;
    for(int i = 0; i < 11000000; i++)
    {
        int x = i, ans = 0;
        while(x > 9)
        {
            ans += x % 10;
            if(ans > 10)
                break;
            x /= 10;
        }
        ans += x;
        if(ans == 10)
            a[num++] = i;
    }
    int n;
    while(cin >> n)
    {
        cout << a[n - 1] << endl;
    }
    return 0;
}
C 横纵暴搜
#include<bits/stdc++.h>
using namespace std;
const int MAX = 2005;
char a[MAX][MAX];
int h[MAX][MAX], z[MAX][MAX];
int main()
{
    int n, m, k, ans = 0;
    cin >> n >> m >> k;
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
        int x = 0;
        for(int j = 0; j < m; j++)
        {
            if(a[i][j] == '.')
                h[i][j] = ++x;
            else
                h[i][j] = x = 0;
        }
    }
    for(int i = 0; i < m; i++)
    {
        int x = 0;
        for(int j = 0; j < n; j++)
        {
            if(a[j][i] == '.')
                z[j][i] = ++x;
            else
                z[j][i] = x = 0;
        }
    }
    for(int i = 0; i < n; i++)
        for(int j = 0; j < m; j++)
            ans = ans + (h[i][j] >= k) + (z[i][j] >= k);
    if(k == 1)
        ans /= 2;
    cout << ans << endl;
    return 0;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值