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. html template--(来自网易)

    html template   概述 包含完整头部信息和主体结构的HTML基础模板. 代码展示 <!DOCTYPE html> <html> <head> < ...

  2. 20155206 2016-2017-2 《Java程序设计》第8周学习总结

    20155206 2016-2017-2 <Java程序设计>第8周学习总结 教材学习内容总结 第十五章 通用API 15.1 日志 日志API简介 java.util.logging包提 ...

  3. 【问题收集·知识储备】Xcode只能选择My Mac,不能选择模拟器如何解决?

      网友问题:请问打开一个应用,只能选择My Mac,不能选择模拟器如何解决? 答案:             下面将问答过程记录如下:     CHENYILONG Blog 请问打开一个应用,只能 ...

  4. 产品排序(2015 年北大自招夏令营) (与栈相关的区间DP)

    题面: \(solution:\) 又是一道\(DP\)的好题啊!状态并不明显,需要仔细分析,而且还结合了栈的特性! 做这一类题,只要出题人有点理想,一定会在栈的性质上做点文章,所以我们尽量围绕栈的性 ...

  5. mysql 1045 access denied for user 解决方法

    提示:1045 access denied for user 'root'@'localhost' using password yes方法一: # /etc/init.d/mysql stop #  ...

  6. js自定制周期函数

    function mySetInterval(fn, milliSec,count){ function interval(){ if(typeof count==='undefined'||coun ...

  7. C# UDP广播消息

    首先是发送端: /// <summary> /// 发送UDP消息 /// </summary> /// <param name="msg">消 ...

  8. Flask源码解析:Flask上下文

    一.上下文(Context) 什么是上下文: 每一段程序都有很多外部变量.只有像Add这种简单的函数才是没有外部变量的.一旦你的一段程序有了外部变量,这段程序就不完整,不能独立运行.你为了使他们运行, ...

  9. CSS之:active选择器

    Active的一段话 active的英文解释为“积极的”,表现在鼠标上就是点击的意思.关于active选择器最多的示例恐怕就是应用在链接上面的,然而打开链接是一个一瞬间的动作,这不能很好的体现acti ...

  10. wpf XAML 设计器异常,提示NullReferenceException 未将对象引用设置到对象例

    设计了一个控件,然后在使用该控件的界面上,出现上图,这个应该是设计器的bug,解决办法 不要在界面上直接写Load事件 在cs构造函数里手动注册,并且在控件的构造函数里增加判断 if (Designe ...