A. Find Square

找到对角线的两个点的坐标,这道题就迎刃而解了。

inline void work(int n) {
int m;
cin >> m;
memset(str, 0, sizeof(str));
rep(i,1,n) {
scanf("%s", str+1);
rep(j,1,m) a[i][j] = (str[j] == 'B' ? 1 : 0);
} int lx = 0, ly = 0, rx = 0, ry = 0; for (int i = n; i >= 1; -- i) {
rep(j,1,m)
if (a[i][j] == 1) {lx = i; ly = j;break;}
if (lx != 0) break;
} rep(i,1,n) {
for (int j = m; j >= 1; -- j)
if (a[i][j] == 1) {rx = i; ry = j;break;}
if (rx != 0) break;
} cout << (lx + rx) / 2 << " " << (ly + ry) / 2 << endl;
}

B. Unnatural Conditions

考虑到位数远远大于\(n,m\)的值,直接选择构造出\(s(a)\ >\ max(n),\ s(b)\ >\ max(m),\ s(a\ +\ b)\ = \ 1\)

inline void work(int n, int m) {
rep(i,1,2230) cout << 5;
cout << endl;
rep(i,1,2229) cout << 4;
cout << 5 << endl;
}

AIM Tech Round 5 (rated, Div. 1 + Div. 2)的更多相关文章

  1. AIM Tech Round 5 (rated, Div. 1 + Div. 2) (A, B, E)

    B.Unnatural Conditions 题目链接 : http://codeforces.com/contest/1028/problem/B #include<iostream> ...

  2. AIM Tech Round 5 (rated, Div. 1 + Div. 2) C. Rectangles 【矩阵交集】

    题目传传传送门:http://codeforces.com/contest/1028/problem/C C. Rectangles time limit per test 2 seconds mem ...

  3. AIM Tech Round 5 (rated, Div. 1 + Div. 2) E(思维,构造)

    #include<bits/stdc++.h>using namespace std;long long a[150007];long long ans[150007];int main( ...

  4. AIM Tech Round 5 (rated, Div. 1 + Div. 2) D(SET,思维)

    #include<bits/stdc++.h>using namespace std;const long long mod = 1e9+7;char s[370007][27];long ...

  5. 【AIM Tech Round 5 (rated, Div. 1 + Div. 2) 总结】【题解往前或往后翻,不在这】

    又是爆炸的一场 心态有点小崩.但问题不大.. 看A题,一直担心有多个正方形..小心翼翼地看完之后,毅然地交上去了. [00:08] A[Accpted] 然后开始看B题. 觉得和之前做的某题很像,但翻 ...

  6. 【AIM Tech Round 5 (rated, Div. 1 + Div. 2) A】 Find Square

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 找到左上角.往下一直走,往右一直走走到B边界就好. 中点的话.直接输出中位数 [代码] #include <bits/stdc ...

  7. 【AIM Tech Round 5 (rated, Div. 1 + Div. 2) B】Unnatural Conditions

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 让a+b的和为100000000...0这样的形式就好了 这样s(a+b)=1<=m就肯定成立了(m>=1) 然后至于s ...

  8. 【 AIM Tech Round 5 (rated, Div. 1 + Div. 2) C】Rectangles

    [链接] 我是链接,点我呀:) [题意] 给你n个矩形. 让你找出一个点(x,y) 使得这个点在其中至少(n-1)个矩形中. [题解] 若干个矩形交在一起的话. 它们所有的公共区域也会是一个矩形. 这 ...

  9. Codeforces AIM Tech Round 5 (rated, Div. 1 + Div. 2)

    A. Find Square time limit per test: 1 second memory limit per test: 256 megabytes input: standard in ...

随机推荐

  1. 启动Solr时报 _version_ field must exist in schema 错误的解决方法

    Solr启动时报 org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Unable to use up ...

  2. shell批量重命令文件脚本

    批量重命名脚步记录,以备用 假如有一批11.txt 12.txt 13,txt 14.txt 15.txt脚步要要重命名为1.txt 2.txt 3.txt .... 脚本如下: #!/bin/bas ...

  3. 【Android】Android 发送短信和打电话的方法

    发送短信的方法 有两种方法可以实现发送短信,其一是使用intent-startActivity,URI数据格式为"smsto:num",调用的action为Intent.ACTIO ...

  4. 宝塔面板快速开启https服务

    最近在做小程序开发,急需要一个https的域名,首先我的域名是阿里云的,服务器是腾讯云的,操作都一样: 无论阿里云还是腾讯云,配置SSL是针对服务器的,所以首先是要去申请 腾讯/阿里云服务器的SSL( ...

  5. linux注意的一些地方

    assert宏的原型定义在<assert.h>中,其作用是如果它的条件返回错误,则终止程序执行 #include <assert.h>void assert( int expr ...

  6. mycelipse中关于编码的配置

    (1)修改工作空间的编码方式: Window->Preferences->General->Workspace->Text file Encoding在Others里选择需要的 ...

  7. laydate设置起始时间,laydate设置开始时间和结束时间

    //设置开始时间 var startDate = laydate.render({ elem: '#start_date',//开始时间选择控件id min:'2018-6-1', type: 'da ...

  8. android qq开合表

    qq悬浮列表功能暂未实现 main.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/andr ...

  9. (转)Spring Boot中使用AOP统一处理Web请求日志

    AOP为Aspect Oriented Programming的缩写,意为:面向切面编程,通过预编译方式和运行期动态代理实现程序功能的统一维护的一种技术.AOP是Spring框架中的一个重要内容,它通 ...

  10. CentOS 7 集群使用NTP进行时间同步

    NTP时钟同步方式说明NTP在linux下有两种时钟同步方式,分别为直接同步和平滑同步: 直接同步 使用ntpdate命令进行同步,直接进行时间变更.如果服务器上存在一个12点运行的任务,当前服务器时 ...