2016四川省赛A,C【写了1w个if的水题】
A题:
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <queue>
#include <math.h>
using namespace std;
typedef long long LL;
const int MAX=100010;
int n,m;
int a[MAX],b[MAX];
int main()
{
int i,j,k,t,l;
int a,b,c;
while(~scanf("%d%d%d",&a,&b,&c))
{
int sum=0;
int a1,a2,b1,b2,c1,c2;
scanf("%d%d%d",&a1,&b1,&c1);
scanf("%d%d%d",&a2,&b2,&c2);
if(a>=a2)
sum+=(a-a2)*(a-a2);
else if(a<=a1)
sum+=(a1-a)*(a1-a);
if(b>=b2)
sum+=(b-b2)*(b-b2);
else if(b<=b1)
sum+=(b1-b)*(b1-b);
if(c>=c2)
sum+=(c-c2)*(c-c2);
else if(c<=c1)
sum+=(c1-c)*(c1-c);
printf("%d\n",sum);
}
return 0;
}
C题:
#include <bits/stdc++.h>
using namespace std; typedef long long LL; int main()
{
LL a,b,c;
LL sum;
scanf("%lld%lld%lld",&a,&b,&c);
sum=a+2*b+3*c;
if(!a&&!b&&!c)
{
puts("0");
}
if(a==0&&b==0&&c)
{
printf("%lld\n",sum/3);
}
if(a>=1&&b>=1&&c)
{
printf("%lld\n",sum);
}
if(a>=2&&b==0&&c)
{
printf("%lld\n",sum);
}
if(a==1&&!b&&c)
{
printf("%lld\n",sum*2/3+1);
}
if(a==0&&b==1&&c)
{
printf("%lld\n",2*sum/3);
}
if(a==0&&b>=2&&c)
{
printf("%lld\n",sum-2);
}
if(!a&&b&&!c)
{
printf("%lld\n",sum/2);
}
if(a&&b&&!c)
{
printf("%lld\n",sum);
}
if(a&&!b&&!c)
{
printf("%lld\n",sum);
}
return 0;
}
2016四川省赛A,C【写了1w个if的水题】的更多相关文章
- 2016四川省赛 Floyd-Warshall
这题真的有毒 首先你忽略 N-M < 100 的条件你就gg吧 其次就算你知道了怎么做之后 还有可能因为写vector或者各种常数大的原因被卡 #include<iostream> ...
- uva 110 Meta-Loopless Sorts 用程序写程序 有点复杂的回溯水题
题目要求写一个直接用比较排序的pascal程序,挺有趣的一题. 我看题目数据范围就到8,本来以为贪个小便宜,用switch输出. 然后发现比较次数是阶乘级别的,8的阶乘也是挺大的,恐怕会交不上去. 于 ...
- Codeforces Round #348 (VK Cup 2016 Round 2, Div. 2 Edition) A. Little Artem and Presents 水题
A. Little Artem and Presents 题目连接: http://www.codeforces.com/contest/669/problem/A Description Littl ...
- VK Cup 2016 - Round 1 (Div. 2 Edition) A. Bear and Reverse Radewoosh 水题
A. Bear and Reverse Radewoosh 题目连接: http://www.codeforces.com/contest/658/problem/A Description Lima ...
- 【2019.7.24 NOIP模拟赛 T1】道路建设(road)(水题)
原题与此题 原题是一道神仙不可做题,两者区别在于,原题不能有重边和自环. 然而,这题可以有重边... 于是这题就变成了一道大水题. 此题的解法 考虑如何构造. 对于\(n\le10^4\)的情况: 对 ...
- 2016湖南省赛----G - Parenthesis (括号匹配)
2016湖南省赛----G - Parenthesis (括号匹配) Bobo has a balanced parenthesis sequence P=p 1 p 2…p n of lengt ...
- 2016湖南省赛----A 2016 (同余定理)
2016湖南省赛----A 2016 (同余定理) Description 给出正整数 n 和 m,统计满足以下条件的正整数对 (a,b) 的数量: 1. 1≤a≤n,1≤b≤m; 2. a×b 是 ...
- 2016湖南省赛 I Tree Intersection(线段树合并,树链剖分)
2016湖南省赛 I Tree Intersection(线段树合并,树链剖分) 传送门:https://ac.nowcoder.com/acm/contest/1112/I 题意: 给你一个n个结点 ...
- ytu 1050:写一个函数,使给定的一个二维数组(3×3)转置,即行列互换(水题)
1050: 写一个函数,使给定的一个二维数组(3×3)转置,即行列互换 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 154 Solved: 112[ ...
随机推荐
- 顺序容器vector,deque,list的选用规则
前言 常见的顺序容器主要有三种 - vector,deque,list.它们实现的功能相差不大,那么实际开发中该如何进行选择呢?本文将为你解答这个问题. 分析 由于这三种容器实现的数据结构原型不同(v ...
- linux shell 的前世今生和流行BASH SHELL的特点
前言 shell作为用户和操作系统内核交互的接口,也不断的在发展迭代.shell的发展也离不开unix/linux 系统的发展.并且在开源社区对shell的发展也起到了推动作用. 内容思维导图简介 发 ...
- EasyDarwin开源流媒体云平台VS调试断点提示“还没有为该文档加载任何符号”的解决办法
本文转自EasyDarwin开源团队成员Alex的博客:http://blog.csdn.net/cai6811376/article/details/52063666 近日,我们EasyDarwin ...
- linux socket详解
1 linux socket编程的固定模式 server端,bind.listen.accept client端,connect client端和server端之间的一次通信: client端,wri ...
- netty+Protobuf (整合一)
netty+Protobuf 整合实战 疯狂创客圈 死磕Netty 亿级流量架构系列之12 [博客园 总入口 ] 本文说明 本篇是 netty+Protobuf 整合实战的 第一篇,完成一个 基于Ne ...
- AndroidTest.java
以下代码使用ApiDemos-debug.apk进行测试 package com.saucelabs.appium; import io.appium.java_client.AppiumDriver ...
- Android 启动过程介绍【转】
本文转载自:http://blog.csdn.net/yangwen123/article/details/8023654 一般开机过程大致可以分为三个大阶段: 1. OS级别,由bootloader ...
- UVA1025 A Spy in the Metro —— DP
题目链接: https://vjudge.net/problem/UVA-1025 题解: 详情请看紫书P267. 与其说是DP题,我觉得更像是模拟题,特别是用记忆化搜索写. 递推: #include ...
- RAC环境下oracle实例启动问题:ora-01565,ora-17503
今天有现场因为突然听电,数据库服务器停了,需要我远程重启一下. 现场是RAC环境,oracle10.2.0.4. 登录后,startup,报错如下 根据报错,初步判断是共享数据文 ...
- Tensorflow深度学习之十二:基础图像处理之二
Tensorflow深度学习之十二:基础图像处理之二 from:https://blog.csdn.net/davincil/article/details/76598474 首先放出原始图像: ...