后天考试,今天做题,我真佩服自己。。。

这次又只A俩水题。。。

orz各路神犇。。。

话说这次模拟题挺多。。。

半个多小时把前面俩水题做完,然后卡C,和往常一样,题目看懂做不出来。。。

A:

算是模拟吧,反正看懂题目后很可耻的生硬水果,没被hack我觉得非常开心。。。

由于要求两个人至少一个没跳过,画图后发现很偷懒的方法。

虽然跟样例不同,但过了。。。

#include <cstdio>
int main() {
int n, m;
scanf("%d%d", &n, &m);
printf("%d\n", n + m - 1);
for (int i = 1; i <= m; i++)
printf("1 %d\n", i);
for (int i = 2; i <= n; i++)
printf("%d 1\n", i);
return 0;
}

B:

本来直接全部做成最大纯色,然后考虑杂色,wa了。

发现想错了,比如3 5 5,如果按原来想法会得出3,而它可以先做两个纯色为3 2 2,然后做2个混色为1 0 0。

于是想出算法,比赛时没被room里面的大神没被hack,事后发现过不了新加的数据15。。。

太晚碎觉,明天看吧。。。

下面是原来的代码:

#include <cstdio>
long min(long a, long b, long c)
{
if (a > b)
a = b;
if (c > a)
c = a;
return c;
}
int main() {
long r, g, b;
long sum = 0;
scanf("%ld%ld%ld", &r, &g, &b);
sum += r/3 + g/3 + b/3;
r % 3 == 0 ? r = 3, sum-- : r = r % 3;
g % 3 == 0 ? g = 3, sum-- : g = g % 3;
b % 3 == 0 ? b = 3, sum-- : b = b % 3;
sum += min(r, g, b);
printf("%ld\n", sum);
return 0;
}

重判错了,发现两个错误:

当min(1, 3, 3)时返回1,其实可以做出两个的,于是改了下。

当输入里面有0时会出错(感谢@CS_liuqing 童鞋的指出)。

修改后A过了(蒻菜的代码很蒻):

#include <cstdio>
long func(long a, long b, long c)
{
if ((c == 1 && a == 3 && b == 3) || (b == 1 && a == 3 && c == 3) || (a == 1 && b == 3 && c == 3))
return 2;
if (a > b)
a = b;
if (c > a)
c = a;
return c;
}
int main() {
long r, g, b;
long sum = 0;
scanf("%ld%ld%ld", &r, &g, &b);
sum += r/3 + g/3 + b/3;
if (r && g && b) {
r % 3 == 0 ? r = 3, sum-- : r = r % 3;
g % 3 == 0 ? g = 3, sum-- : g = g % 3;
b % 3 == 0 ? b = 3, sum-- : b = b % 3;
sum += func(r, g, b);
printf("%ld\n", sum);
}
else
printf("%ld\n", sum);
return 0;
}

C:

模拟题,其实不是。。。模拟起来必须超时。。。

思路到后面已经有了,拖拉太久时间不够。

三鲜大神说:A 的意思就是 kx + b = y,判断整除就可以了。

膜拜中。

赛后写出来的题解

这里是只水水题的水果君,转载请注明。

http://blog.csdn.net/hcbbt

Codeforces Round #190 (Div. 2) 水果俩水题的更多相关文章

  1. Codeforces Round #185 (Div. 2) B. Archer 水题

    B. Archer Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/312/problem/B D ...

  2. Codeforces Round #360 (Div. 2) A. Opponents 水题

    A. Opponents 题目连接: http://www.codeforces.com/contest/688/problem/A Description Arya has n opponents ...

  3. Codeforces Round #256 (Div. 2/A)/Codeforces448A_Rewards(水题)解题报告

    对于这道水题本人觉得应该应用贪心算法来解这道题: 下面就贴出本人的代码吧: #include<cstdio> #include<iostream> using namespac ...

  4. Codeforces Round #340 (Div. 2) B. Chocolate 水题

    B. Chocolate 题目连接: http://www.codeforces.com/contest/617/problem/D Descriptionww.co Bob loves everyt ...

  5. Codeforces Round #340 (Div. 2) A. Elephant 水题

    A. Elephant 题目连接: http://www.codeforces.com/contest/617/problem/A Descriptionww.co An elephant decid ...

  6. Codeforces Round #340 (Div. 2) D. Polyline 水题

    D. Polyline 题目连接: http://www.codeforces.com/contest/617/problem/D Descriptionww.co There are three p ...

  7. Codeforces Round #338 (Div. 2) A. Bulbs 水题

    A. Bulbs 题目连接: http://www.codeforces.com/contest/615/problem/A Description Vasya wants to turn on Ch ...

  8. Codeforces Round #282 (Div. 1) A. Treasure 水题

    A. Treasure Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/494/problem/A ...

  9. Codeforces Round #327 (Div. 2) B. Rebranding 水题

    B. Rebranding Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/591/problem ...

随机推荐

  1. [iOS基础控件 - 6.10] Notification 通知机制

    A.定义      iOS程序都有一个NSNotificationCenter的单例对象,用来负责发布不同对象之间的通知      任何对象都能够在NSNotificationCenter发布通知,发 ...

  2. javascript中对象的每个实例都具有的属性和方法

  3. OAuth 2.0介绍学习

    OAuth2.0是OAuth协议的下一版本,但不向后兼容OAuth 1.0即完全废止了OAuth1.0. OAuth 2.0关注客户端开发者的简易性.要么通过组织在资源拥有者和HTTP服务商之间的被批 ...

  4. CSS构造表格

    表格的基础构造 边距和边线应用 隐藏和删除应用 简单表格 table {     width:auto;     border-collapse:collapse;(把单元格空隙合并起来)     m ...

  5. TypeScript学习笔记(三):类

    类 在TypeScript中,类似于C#的结构,即一个文件中可以存在多个类,且文件名可以任意取,我们先看一个简单的类的示例. class Person { private name: string; ...

  6. 用BenchmarkDotNet给C#程序做性能测试

    博客搬到了fresky.github.io - Dawei XU,请各位看官挪步.最新的一篇是:用BenchmarkDotNet给C#程序做性能测试.

  7. 十,选择cfee编辑器并学会调试程序。以及结束语。

    为什么推荐用cfree呢?因为我认为这个编辑器界面友好,用起来方便. 你也许会问,调试程序是什么? 那么下面思考几个问题:对于前面讲的分支结构和循环结构有点不懂怎么办?如果写的程序语法没有错误但是运算 ...

  8. RFID与射频卡电器特性

    电气特性: 容量为8K位EEPrOM: ● 分为16个扇区,每个扇区为4块,每块16个字节,以块为存取单位: ● 每个扇区有独立的一组密码及访问控制: ● 每张卡有唯一序列号,为32位: ● 具有防冲 ...

  9. google域名邮箱申请 gmail域名邮箱申请(企业应用套件)指南

    近期一直有朋友问我怎么注冊域名邮箱,于是整理出来,贴出来吧.已经非常具体了,你能够直接对比着做了.什么是域名邮箱? 假设你有一个自己的域名,通过对域名dns进行设置,创建以自己的域名作为邮箱后缀的邮箱 ...

  10. WCF 新手教程二

    基本知识: [ServiceContract] Attribute 能够有以下Property 的: CallbackContract 设置callback的类型:Duplicate指Service ...