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. [转载]AngularJS之Factory vs Service vs Provider

    http://www.oschina.net/translate/angularjs-factory-vs-service-vs-provider http://tylermcginnis.com/a ...

  2. javascript沙箱模式

    沙箱模式解决了命名空间模式的如下几个缺点: 1.对单个全局变量的依赖变成了应用程序的全局变量依赖.在命名空间模式中,是没有办法使同一个应用程序或库的2个版本运行在同一个页面中.2.对这种以点分割的名字 ...

  3. C标准库函数中复杂的函数声明

    <signal.h> 中有一个复杂的函数声明.很叫人费解. void (*signal(int sig, void (*handler)(int)))(int); 我们按照向右看向左看的黄 ...

  4. DDLog设置方法

          CHENYILONG Blog DDLog设置方法 本文永久地址为http://www.cnblogs.com/ChenYilong/p/3984246.html,转载请注明出处. 201 ...

  5. 爬虫笔记之刷小怪练级:yymp3爬虫(音乐类爬虫)

    一.目标 爬取http://www.yymp3.com网站歌曲相关信息,包括歌曲名字.作者相关信息.歌曲的音频数据.歌曲的歌词数据. 二.分析 2.1 歌曲信息.歌曲音频数据下载地址的获取 随便打开一 ...

  6. Explain EV in /proc/bus/input/devices data【转】

    转自:https://unix.stackexchange.com/questions/74903/explain-ev-in-proc-bus-input-devices-data It repre ...

  7. 抓包获取百度音乐API

    这次抓包是获取手机APP中的数据包,共分为三个部分: 1.win7建立wifi 2.PC架设代理服务器 手机设置代理 3.抓包分析 一.win7建立wifi 在win7下搭建wifi非常简单,网上的教 ...

  8. jquery模型(外壳实现)

    详细解释: 1.现在传入的参数是window,document,可以知道是它俩引用 2. 3. 4.每次调用jquery方法,都会创建一个实例,但是内存并没有暴涨,原因是:jquery里面new 的这 ...

  9. 20175225《java程序设计》第五周学习总结

    20175225 2018-2019-2 <Java程序设计>第5周学习总结 教材学习内容总结 1.接口体中包含常量的声明(没有变量)和抽象方法两部分.接口体中只有抽象方法,没有普通的方法 ...

  10. tomcat错误信息解决方案【严重:StandardServer.await: create[8005]】

    错误信息:   严重: StandardServer.await: create[8005]:  java.net.BindException: Address already in use: JVM ...