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

CF 965

时间:2018-04-27 02:16:22      阅读:283      评论:0      收藏:0      [点我收藏+]

标签:queue   cstring   its   技术分享   pac   div   closed   c++   spl   

A

技术分享图片
/*#include<cstring>#include<algorithm>#include<queue>#include<vector>#include<cstdio>#include<cmath>#include<iostream>*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 300005;
int main()
{
        int k, n, s, p;
        cin >> k >> n >> s >> p;
        int ans = n / s + (1 - (n % s == 0));
        ans *= k;
        cout << ans / p + (1 - (ans % p == 0)) << endl;
        return 0;
}
View Code

B

技术分享图片
/*#include<cstring>#include<algorithm>#include<queue>#include<vector>#include<cstdio>#include<cmath>#include<iostream>*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 300005;
char f[105][105];
int ans;
int aimc = 1;
int aimr = 1;
int flag;
int now;
int main()
{
        int n, k;
        cin >> n >> k;
        for (int i = 1; i <= n; i++)
        {
                scanf("%s", f[i] + 1);
        }
        for (int i = 1; i <= n; i++)
        {
                for (int j = 1; j <= n; j++)
                {
                        if (f[i][j] == #)
                        {
                                continue;
                        }
                        now = 0;
                        for (int dx = j - k + 1; dx <= j; dx++)
                        {
                                if (dx + k > n + 1)
                                {
                                        break;
                                }
                                if (dx < 1)
                                {
                                        continue;
                                }
                                flag = 1;
                                for (int w = dx; w <= dx + k - 1; w++)
                                {
                                        if (f[i][w] == #)
                                        {
                                                flag = 0;
                                                break;
                                        }
                                }
                                if (flag)
                                {
                                        now++;
                                }
                        }
                        for (int dy = i - k + 1; dy <= i; dy++)
                        {
                                if (dy + k > n + 1)
                                {
                                        break;
                                }
                                if (dy < 1)
                                {
                                        continue;
                                }
                                flag = 1;
                                for (int w = dy; w <= dy + k - 1; w++)
                                {
                                        if (f[w][j] == #)
                                        {
                                                flag = 0;
                                                break;
                                        }
                                }
                                if (flag)
                                {
                                        now++;
                                }
                        }
                        if (now > ans)
                        {
                                ans = now;
                                aimc = i, aimr = j;
                        }
                }
        }
        cout << aimc << " " << aimr << endl;
        return 0;
}
View Code

C

D

 

CF 965

标签:queue   cstring   its   技术分享   pac   div   closed   c++   spl   

原文地址:https://www.cnblogs.com/Aragaki/p/8955664.html

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