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[ ...
随机推荐
- Microsoft Visual Studio 2013 已停止工作的解决方法
VS最近莫名奇妙老师崩溃,每次只能修复以后才能正常使用, 后参考 http://www.jb51.net/softjc/226465.html 网页的介绍, 恍然:之前使用OSchina GIT 服务 ...
- EasyDarwin开源流媒体服务器性能优化之Work-stealing优化方案
本文转自EasyDarwin开源团队成员Alex的博客:http://blog.csdn.net/cai6811376/article/details/52400226 EasyDarwin团队的Ba ...
- EasyDarwin流媒体云平台架构
EasyDarwin目前正在做的开源流媒体云平台架构:
- if __name__ == "__main__": 怎么理解?
参考:https://www.cnblogs.com/Neeo/p/9504779.html 总结: 1.防止模块间调用时,执行被调用模块实例化执行,换句话说,就是不要执行调用模块原来实例化的内容 2 ...
- 内核中led触发器实例【转】
本文转载自:http://blog.csdn.net/yuanlulu/article/details/6438847 ======================================== ...
- LightOJ1197 Help Hanzo —— 大区间素数筛选
题目链接:https://vjudge.net/problem/LightOJ-1197 1197 - Help Hanzo PDF (English) Statistics Forum Tim ...
- 自动化测试框架selenium+java+TestNG——读取csv文件
读取csv文件可以直接读取,也可以使用javacsv.jar,后者比较简单,这个也可以变相认为是对表格的处理,我们可以在表格中做好数据,存储成csv格式的文件,后续对xlsx表格的操作抽个时间再记录下 ...
- 报错:'Navigator is deprecated and has been removed from this package. It can now be installed
报错:'Navigator is deprecated and has been removed from this package. It can now be installed ' + ...
- ffmpeg 的一些学习网站
http://blog.csdn.net/leixiaohua1020/article/category/1360795 雷霄骅(leixiaohua1020)的专栏 http://dranger.c ...
- 动态注册BroadcastReceiver
1. [代码][Java]代码 package com.zjt.innerreceiver; import android.app.Service; import android.con ...