A

题解:保证一个三角形的话,得两边之和大于第三边才行,所以都拿来判一判就好了。

#include <iostream>
using namespace std;
int main(){
int t,a,b,c;
cin>>t;
while(t--){
cin>>a>>b>>c;
if(a+b<=c){
cout<<"No"<<endl;
continue;
}
else if(a+c<=b){
cout<<"No"<<endl;
continue;
}
else if(b+c<=a){
cout<<"No"<<endl;
continue;
}
else{
cout<<"Yes"<<endl;
continue;
}
}
return 0;
}

B

题解:令len为字符串的长度,那么T/len个循环,再暴力枚举T%len长度的答案就好了。

include

#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <vector>
#include <numeric>
#include <iostream>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <functional>
#include <tuple>
#include <cassert> #define for_each_test_cases(T) int T; scanf("%d", &T); for (int cas = 1; cas <= T; cas++) const int MaxN = 5005;
char s[MaxN];
int n, m; std::pair<int, int> move(const std::pair<int, int>& now, const char& c) {
if (c == 'E') return std::make_pair(now.first + 1, now.second);
if (c == 'S') return std::make_pair(now.first, now.second - 1);
if (c == 'W') return std::make_pair(now.first - 1, now.second);
/* N */ return std::make_pair(now.first, now.second + 1);
} int main() {
scanf("%s%d", s, &m);
n = strlen(s);
std::pair<int, int> now(0, 0), dir(0, 0);
for (int i = 0; i < n; i++) {
dir = move(dir, s[i]);
}
now = std::make_pair(dir.first * (m / n), dir.second * (m / n));
m %= n;
for (int i = 0; i < m; i++) {
now = move(now, s[i]);
}
printf("%d %d\n", now.first, now.second);
return 0;
}

C

题解:正常想法是随机,感觉上来说随机几次就能AC。但是随机种子,决定了你的随机数。Srand(time(NULL))是不行的,因为这个OJ采用的是并发测评的模式,所以你获取的TIME(null)种子是一样的。

这儿一个正确做法是,抓取定义字符的内存,这个内存地址是随机的,然后来随机就好了。

个人觉得 做法千千万,只要能AC就行。

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h> int main() {
int* a = new int[5];
srand((unsigned long) a);
delete[] a;
printf("%d\n", (rand() & 1) + 1);
return 0;
}

D

题解:实际上n=100嘛,就直接暴力n^3for一下就好了嘛。如果不知道怎么算面积的话,去百度搜海伦公式。

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <vector>
#include <numeric>
#include <iostream>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <functional>
#include <tuple>
#include <cassert> #define for_each_test_cases(T) int T; scanf("%d", &T); for (int cas = 1; cas <= T; cas++) const int MaxN = 105;
int n;
int a[MaxN]; int main() {
scanf("%d", &n);
for (int i = 0; i < n; i++) scanf("%d", &a[i]);
std::sort(a, a + n);
double res = -1;
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
for (int k = j + 1; k < n; k++) {
if (a[i] + a[j] <= a[k]) continue;
double p = (a[i] + a[j] + a[k]) / 2.0;
res = std::max(res, sqrt(p * (p - a[i]) * (p - a[j]) * (p - a[k])));
}
}
}
printf("%.0f\n", res);
return 0;
}

E

题解:

直接数日历嘛(不

你以某一天为基准,然后暴力推2016年的所有天,是星期几就好了。

#include<iostream>
using namespace std;
int main()
{
int k;
string j;
char s[6];
while(cin>>k>>j>>s)
{
if(s[0]=='w')
{
if(k==5||k==6)
{
cout<<"53"<<endl;
}
else cout<<"52"<<endl;
}
else
{
if(k==30)
{
cout<<"11"<<endl;
}
if(k==31)
{
cout<<"7"<<endl;
}
if(k!=30&&k!=31)
{
cout<<"12"<<endl;
}
}
}
return 0;
}

喵哈哈村的魔法考试 Round #3 (Div.2) 题解的更多相关文章

  1. 喵哈哈村的魔法考试 Round #2 (Div.2) 题解

    喵哈哈村的魔法考试 Round #2 (Div.2) 题解 A.喵哈哈村的战争 题解: 这道题就是for一遍,统计每个村子的战斗力的和,然后统计哪个村子的战斗力和大一点就好了. 唯一的坑点,就是这道题 ...

  2. 喵哈哈村的魔法考试 Round #1 (Div.2) 题解

    喵哈哈村的魔法考试 Round #1 (Div.2) 题解 特别感谢出题人,qscqesze. 也特别感谢测题人Xiper和CS_LYJ1997. 没有他们的付出,就不会有这场比赛. A 喵哈哈村的魔 ...

  3. 喵哈哈村的魔法考试 Round #7 (Div.2) 题解

    喵哈哈村的魔法考试 Round #7 (Div.2) 注意!后四道题来自于周日的hihocoder offer收割赛第九场. 我建了个群:欢迎加入qscoj交流群,群号码:540667432 大概作为 ...

  4. 喵哈哈村的魔法考试 Round #1 (Div.2) 题解&源码(A.水+暴力,B.dp+栈)

    A.喵哈哈村的魔法石 发布时间: 2017年2月21日 20:05   最后更新: 2017年2月21日 20:06   时间限制: 1000ms   内存限制: 128M 描述 传说喵哈哈村有三种神 ...

  5. 喵哈哈村的魔法考试 Round #19 (Div.2) 题解

    题解: 喵哈哈村的魔力源泉(1) 题解:签到题. 代码: #include<bits/stdc++.h> using namespace std; int main(){ long lon ...

  6. 喵哈哈村的魔法考试 Round #14 (Div.2) 题解

    喵哈哈村的四月半活动(一) 题解: 唯一的case,就是两边长度一样的时候,第三边只有一种情况. #include <iostream> #include <cstdio> # ...

  7. 喵哈哈村的魔法考试 Round #4 (Div.2) 题解

    有任何疑问,可以加我QQ:475517977进行讨论. A 喵哈哈村的嘟嘟熊魔法(1) 题解 这道题我们只要倒着来做就可以了,因为交换杯子是可逆的,我们倒着去模拟一遍就好了. 有个函数叫做swap(a ...

  8. 喵哈哈村的魔法考试 Round #20 (Div.2) 题解

    题解: A 喵哈哈村的跳棋比赛 题解:其实我们要理解题意就好了,画画图看看这个题意.x<y,那么就交换:x>y,那么x=x%y. 如果我们经过很多次,或者y<=0了,那么就会无限循环 ...

  9. 喵哈哈村的魔法考试 Round #18 (Div.2) 题解

    喵哈哈村的古怪石碑(一) 题解:暴力check一下是等比数列还是等差数列,然后输出答案即可.注意如果数据范围是1e9的话,就要快速幂了. 代码: #include <cstdio> #in ...

  10. 喵哈哈村的魔法考试 Round #13 (Div.2) 题解

    喵哈哈村的木星传说(一) 旋转90°,找找规律就知道(x,y)->(n-1-y,x) 然后输出就好了. #include<bits/stdc++.h> using namespace ...

随机推荐

  1. SQL中的全局变量和局部变量(@@/@)

    在SQL中,我们常常使用临时表来存储临时结果,对于结果是一个集合的情况,这种方法非常实用,但当结果仅仅是一个数据或者是几个数据时,还要去建一个表,显得就比较麻烦,另外,当一个SQL语句中的某些元素经常 ...

  2. SQL语句(十一)函数查询

    (十一)函数查询 1. 聚合函数 对一组值进行计算,得到一个返回值 SUM(), 求和 AVG(), 求平均 MIN(), 求最小 MAX(), 求最大 COUNT(), 计数,即个数 --例1 求所 ...

  3. Stochastic Optimization Techniques

    Stochastic Optimization Techniques Neural networks are often trained stochastically, i.e. using a me ...

  4. 用phpStorm的数据库工具来管理你的数据库

    phpStorm是一个功能强大的IDE,不仅对PHP提供了支持,而且对前端HTML.CSS.JavaScript的支持也是非常不错的.此外,phpStorm还集成了很多实用的功能,下面就phpStor ...

  5. Myeclipse/STS 首次在本地部署配置一个Spring MVC 项目 (十二)

    1. 在本地新创建一个文件夹 ,做为项目工作空间; 2. 用 Myeclipse 或 STS 进入该文件夹,该文件夹就成为项目的工作空间: 3. 就要进 窗口-首选项,配置: 环境默认编码: 1> ...

  6. AngularJS入门基础——过滤器

    在HTML中的模板绑定符号{{ }}内通过 | 符号来调用过滤器 {{ name | uppercase }}   以HTML的形式使用过滤器时,如果需要传递参数给过滤器,只要在过滤器名字后面加冒号即 ...

  7. 【51Nod】1273 旅行计划 树上贪心

    [题目]51Nod 1273 旅行计划 [题意]给定n个点的树和出发点k,要求每次选择一个目的地旅行后返回,使得路径上未访问过的点最多(相同取编号最小),旅行后路径上所有点视为访问过,求旅行方案.\( ...

  8. the error about “no such file or directory”

    CHENYILONG Blog the error about "no such file or directory" when you get the question like ...

  9. 【SVN】命令行忽略不必要的文件和文件夹

    SVN命令参考:   https://www.cnblogs.com/wlsxmhz/p/5775393.html 我们需要明白命令行设置忽略文件和文件夹是通过设置svn:ignore属性设置的,pr ...

  10. http和socket之长连接和短连接区别【转】

    转自:https://blog.csdn.net/mengyafei43/article/details/25195445 TCP/IP TCP/IP是个协议组,可分为三个层次:网络层.传输层和应用层 ...