http://codeforces.com/contest/334

A题意:1-n^2 平均分成 n 份,每份n个数,且和相同

解法 : 构造矩阵1-n^2的矩阵即可

int a[][];
int main()
{
int n;
scanf("%d",&n);
int k = n*n;
int c = ;
for(int i = ; i < n ; i++)
for(int j = ; j < n ; j++)
a[i][j] = c++;}
for(int i = ; i < n ; i++)
{
for(int j = ; j < n ; j++)
printf("%d ",a[j][(i+j)%n]);
puts("");
}
return ;
}

B:8个点能否关于矩形对称

解法: 直接暴力判断8个点,注意判重

struct point
{
int x,y;
}p[];
int cmp(point a,point b){
if(a.x == b.x) return a.y<b.y;
return a.x < b.x;
}
int main()
{
for(int i = ; i < ; i++)
cin>>p[i].x>>p[i].y;
sort(p,p+,cmp);
for(int i = ; i < ; i++)
for(int j = ; j < ; j++)
if(i != j && p[i].x == p[j].x && p[i].y == p[j].y)
{
cout<<"ugly"<<endl;
return ;
}
if(p[].x == p[].x && p[].x == p[].x && p[].x == p[].x
&& p[].x == p[].x && p[].x == p[].x)
{
if(p[].y == p[].y && p[].y == p[].y && p[].y == p[].y
&& p[].y == p[].y && p[].y == p[].y)
cout<<"respectable"<<endl;
else cout<<"ugly"<<endl;
}else cout<<"ugly"<<endl;
return ;
}

C题意: 用面值为3的次幂的硬币 购买价值为n的商品 , 要求硬币总价值>n且硬币数最多且这些硬币的子集不能>=n

解法 : 贪心,如果非3的倍数一定是n/3+1 即全换成3

否则就不能换成3要换成面值更大的 以此类推直到不为3^k为止

int main() {
LL n;
cin>>n;
while(n % == ) n /= ;
cout<<(n/)+<<endl;
}

D题意: 在n*n矩阵中 有一些不能走的格子, 从边界(非顶角)出发 能直线走到对面边界的最多方案数

解法 : 如果中间没有不能走的格子 ,对于在(x,x)上相交的十字形一共有2种不冲突的放法

可以证出: 其中一定存在一种对其他情况不影响走法 ----------------------------------画图可归纳

奇数情况特判中间点即可

bool bx[],by[];
int n,m;
int main()
{
//freopen("in.txt","r",stdin);
cin>>n>>m;
while(m--)
{
int x,y;
cin>>x>>y;
bx[x] = ;
by[y] = ;
}
int res = ;
for(int i = ; i < n ; i++)
{
if(bx[i] == ) res++;
if(by[i] == ) res++;
}
if(n% == && bx[n/+] == && by[n/+] == ) res--;
cout<<res<<endl;
return ;
}

Codeforces Round #194 (Div. 2) 部分题解的更多相关文章

  1. # Codeforces Round #529(Div.3)个人题解

    Codeforces Round #529(Div.3)个人题解 前言: 闲来无事补了前天的cf,想着最近刷题有点点怠惰,就直接一场cf一场cf的刷算了,以后的题解也都会以每场的形式写出来 A. Re ...

  2. Codeforces Round #557 (Div. 1) 简要题解

    Codeforces Round #557 (Div. 1) 简要题解 codeforces A. Hide and Seek 枚举起始位置\(a\),如果\(a\)未在序列中出现,则对答案有\(2\ ...

  3. Codeforces Round #540 (Div. 3) 部分题解

    Codeforces Round #540 (Div. 3) 题目链接:https://codeforces.com/contest/1118 题目太多啦,解释题意都花很多时间...还有事情要做,就选 ...

  4. Codeforces Round #538 (Div. 2) (A-E题解)

    Codeforces Round #538 (Div. 2) 题目链接:https://codeforces.com/contest/1114 A. Got Any Grapes? 题意: 有三个人, ...

  5. Codeforces Round #531 (Div. 3) ABCDEF题解

    Codeforces Round #531 (Div. 3) 题目总链接:https://codeforces.com/contest/1102 A. Integer Sequence Dividin ...

  6. Codeforces Round #527 (Div. 3) ABCDEF题解

    Codeforces Round #527 (Div. 3) 题解 题目总链接:https://codeforces.com/contest/1092 A. Uniform String 题意: 输入 ...

  7. Codeforces Round #499 (Div. 1)部分题解(B,C,D)

    Codeforces Round #499 (Div. 1) 这场本来想和同学一起打\(\rm virtual\ contest\)的,结果有事耽搁了,之后又陆陆续续写了些,就综合起来发一篇题解. B ...

  8. Codeforces Round #545 (Div. 1) 简要题解

    这里没有翻译 Codeforces Round #545 (Div. 1) T1 对于每行每列分别离散化,求出大于这个位置的数字的个数即可. # include <bits/stdc++.h&g ...

  9. Codeforces Round #624 (Div. 3)(题解)

    Codeforces Round #624 (Div.3) 题目地址:https://codeforces.ml/contest/1311 B题:WeirdSort 题意:给出含有n个元素的数组a,和 ...

随机推荐

  1. 服务器性能监控tips

    一.tops 第一行 当前时间/已运行时间/登录用户数/最近 5 10 15分钟平均负载(平均进程数 cat /proc/loadavg) 除了前3个数字表示平均进程数量外,后面的1个分数,分母表示系 ...

  2. 如何测试WCF Rest

    使用SoapUI 1.新建一个rest项目 2.双击上图中的Request1 查询的时候,Method选择post resource的地方要调整到对应的方法 查询的内容是用json格式发送 查询的的结 ...

  3. Android自定义组件系列【14】——Android5.0按钮波纹效果实现

    今天任老师发表了一篇关于Android5.0中按钮按下的波纹效果实现<Android L中水波纹点击效果的实现>,出于好奇我下载了源代码看了一下效果,正好手边有一个Nexus手机,我结合实 ...

  4. ORA-01659: 无法分配超出 7 的 MINEXTENTS

    plsql连接出错:ORA-01659: 无法分配超出 7 的 MINEXTENTS (在表空间 PERFSTAT 中) 从 Oracle Database 10g Enterprise Editio ...

  5. intellij idea 13

    mac版 http://pan.baidu.com/s/1c0zjWU8 intellij idea 编辑器之于程序员,犹如鞋之于女人.有的女人赤脚都漂亮,性感. 有的女人赤身都没人看.程序员亦如此. ...

  6. Python学习笔记 capture 1

    最近开始学习Python3.x,真的感觉Python的语法与C++,Java有很大的不同,Python从某些方面来说语法更简单.Python作为一种解释性语言和编译型语言如C++来说,还是各有千秋的. ...

  7. c#时间差高精度检查

    两个时间差的高精度检查 static void Main(string[] args) { Console.WriteLine("开始时间:" + DateTime.Now.ToS ...

  8. 计算机科学书籍推荐和CSS、js书籍推荐

    计算机科学:<深入理解计算机系统>,这是基础知识 JavaScript:JavaScript高级程序设计:大名鼎鼎的红宝书 <精通CSS:高级Web标准解决方案>:因为我觉CS ...

  9. 【Linux端口大全】

    2端口:管理实用程序 3端口:压缩进程 5端口:远程作业登录 7端口:回显 9端口:丢弃 11端口:在线用户 13端口:时间 17端口:每日引用 18端口:消息发送协议 19端口:字符发生器 20端口 ...

  10. 【Codeforces Round #460 (Div. 2) A】 Supermarket

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 就是让你求m*(ai/bb)的最小值 [代码] #include <bits/stdc++.h> #define dou ...