North North West
North North West |
Time Limit: 10000ms, Special Time Limit:25000ms, Memory Limit:65536KB |
Total submit users: 71, Accepted users: 59 |
Problem 13406 : No special judgement |
Problem description |
We can describe detailed direction by repeating the directional names: north, south, east and west. For example, northwest is the direction halfway between north and west, and northnorth- west is between north and northwest. In • “north” means 0 degrees. • “west” means 90 • If the direction dir means a degrees and the sum of the Your task is to calculate the angle in degrees |
Input |
The input contains several datasets. The number of datasets does not exceed Each dataset is described by a single line that contains a string |
Output |
For each dataset, print an integer if the angle described by the given |
Sample Input |
north |
Sample Output |
0 |
Problem Source |
JAG Practice Contest for ACM-ICPC Asia Regional 2014 |
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int gcd(int x,int y)
{
if(y%x==)return x;
return gcd(y%x,x);
}
int main (void)
{
int n,m,i,j,k,l;
char str[];
int s[];
while(gets(str)&&str[]!='#')
{
l=;
for(i=;str[i];i++)
if(str[i]=='n')
{
s[l++]=;
i+=;
}else
{
s[l++]=-;
i+=;
}
int x,y;
y=;
if(s[--l]==)
{
x=;
}else
{
x=;
}
k=;
while(l--)
{
x*=;
y*=;
k*=;
if(s[l]==)x-=;
else x+=;
}
int g;
if(x%y==)
printf("%d\n",x/y);
else
{
g=gcd(x,y);
printf("%d/%d\n",x/g,y/g);
} ; }
return ;
}
North North West的更多相关文章
- CodeFroces--Good Bye 2016-B--New Year and North Pole(水题-模拟)
B. New Year and North Pole time limit per test 2 seconds memory limit per test 256 megabytes input s ...
- 【codeforces 750B】New Year and North Pole
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- swift-闭包(代码块)
语法 通用的语法 {(parameters) -> return type in statements } e.g let studname = { println("Welcome ...
- Windows Azure Storage (17) Azure Storage读取访问地域冗余(Read Access – Geo Redundant Storage, RA-GRS)
<Windows Azure Platform 系列文章目录> 细心的用户会发现,微软在国外和国内的数据中心建设都是成对的,比如香港数据中心(Asia East)和新加坡的数据中心(Sou ...
- ExtJs布局详解
序言 1.百度百科上说:ExtJs功能丰富,无人能出其右.无论是界面之美,还是功能之强,extjs都高居榜首. 2.呵呵,界面之美当是少不了布局的,这篇文章我写layout的七种布局.(extjs是4 ...
- silicon labs 代理商
http://www.silabs.com/buysample/pages/contact-sales.aspx?SearchLocation=China Silicon Labs A ...
- java布局学习 (一)
Java 程序通过jvm可以很好的移植到其他平台上,但是java 生成的图形界面样式,在不使用布局的情况下,往往需要重新设定大小,才能在新的平台上调整到最佳样式.这是由于组件的最佳大小 往往是与平台相 ...
- Swift2.3 --> Swift3.0 的变化
Swift3.0语法变化 首先和大家分享一下学习新语法的技巧: 用Xcode8打开自己的Swift2.3的项目,选择Edit->Convert->To Current Swift Synt ...
- Draw_extend使用OpenGL显示数据点
//alter load_map.dev //safety verion 2016/1/12 #include <iostream> #include <fstream> #i ...
随机推荐
- 教了几天C语言 C语言竞赛------家长们你们为什么这么急!!
由于工大某些传统,暑假放一个月,想想有很多事情要做,而且回去也是热着,倒不如不回家了,在哈尔滨正好避暑,又能轻轻松松的吧事情做了,暑假还能有个好的休息,这样想着,最终决定不回去了.其实不回去的话,就会 ...
- 使用python抓取有路网图书信息(原创)
以前挺喜欢去有路网买二手书的,但是有路网有个缺陷,就是放在图书列表中的书很多都没货了,尤其是一些热门的方向,比如android,在列表中的书大多都没有货了,你必须一个一个点进入查看详细信息才能得知图书 ...
- POJ1182并查集
食物链 时间限制:1000 ms | 内存限制:65535 KB 难度:5 描述 动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形.A吃B, B吃C,C吃A. 现有N个动物, ...
- fsockopen
fsockopen — 打开一个网络连接或者一个Unix套接字连接 说明 resource fsockopen ( string $hostname [, int $port = -1 [, int ...
- ora_reco_070361 hs message to agent event 等待事件
现象描述:oracle通过透明网关查询Teradata数据库的表突然变得很慢,小表可以查询出来,大表干脆就出不来. 分析过程: 1.网络可以ping通,小表可以过来,说明网络和网关都没有什么问题的. ...
- 关于vs2013 mysql Ef框架中提示版本不兼容问题的解决办法
<runtime> <assemblyBinding> <dependentAssembly> <assemblyIden ...
- 几条特殊的SQL语句
1, 有case情况. select trunc(exf_payment_receipt.work_date),exf_payment_receipt.exchange_code,exf_paymen ...
- linux之vim编辑器
Vi简介1. Vi是一种广泛存在于各种UNIX和Linux系统中的文本编辑程序.2. Vi不是排版程序,只是一个纯粹的文本编辑程序.3. Vi是全屏幕文本编辑器,它没有菜单,只有命令.4. Vi不是基 ...
- stm32类型cl、vl、xl、ld、md、hd的含义
- startup_stm32f10x_ld_vl.s: for STM32 Low density Value line devices - startup_stm32f10x_ld.s: for ...
- 关于JS中的apply()与call()使用方法与区别
Js apply方法详解我在一开始看到javascript的函数apply和call时,非常的模糊,看也看不懂,最近在网上看到一些文章对apply方法和call的一些示例,总算是看的有点眉目了,在这里 ...