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. 流媒体服务器之————EasyDarwin开源流媒体服务器:编译、配置、部署

    源码下载地址:https://github.com/EasyDarwin/EasyDarwin/archive/v7.0.5.zip 查看 Ubuntu 的版本号 sudo lsb_release - ...

  2. Automate Tdxw

    Automate trade module in Tdxw Code # coding: utf-8 """ Created on Thu Dec 07 10:57:45 ...

  3. html5 canvas 水平渐变描边

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  4. Spring Mvc + Maven + BlazeDS 与 Flex 通讯 (七)

    BlazeDS 说明 BlazeDS是由Adobe开源的基于amf协议的,用于解决flex与java通讯的组件; 基于传统的文本协议的XML传输方式,在抽象层方面会有很大的压力,特别在需要序列化与反序 ...

  5. SOCKET中send和recv函数工作原理与注意点

    https://blog.csdn.net/rankun1/article/details/50488989

  6. nginx1配置文件

    1,查看日志:cat /usr/local/nginx/logs/error.log 2,编辑配置文件:vi /usr/local/nginx/conf/nginx.conf 3,内容:server ...

  7. py-faster-rcnn代码阅读1-train_net.py & train.py

    # train_net.py#!/usr/bin/env python # -------------------------------------------------------- # Fas ...

  8. 关于RestFul API 介绍与实践

    之前演示的PPT,直接看图...     •参考链接: •RESTful API 设计最佳实践 •RESTful API 设计指南 •SOAPwebserivce和RESTfulwebservice对 ...

  9. poj1292

    prim,把每个墙看成一个节点,从起点用prim求最小生成树,直到覆盖到终点为止,输出最小生成树中的最大边 #include <cstdio> #include <cmath> ...

  10. Java中类与类的关系

    在java中类和类的关系大致分三种:泛化.关联.依赖. 1. 泛化(Generalization) "XX是一个XX"关系(is a),通常使用的关键词为 extends.impl ...