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 ...
随机推荐
- frameset,frame应用,常用于后台
<!DOCTYPE HTML><html><head><title>lin3615</title></head><fram ...
- js中的callback(阻塞同步或异步时使用)
1.回调就是一个函数的调用过程,函数a有一个参数,这个参数是个函数b,当函数a执行完以后执行函数b, 那么这个过程就叫回调 eg. function a(callback){ alert('paren ...
- OpenSessionInViewFilter与org.springframework.dao.InvalidDataAccessApiUsageException
报错:org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in r ...
- 原创:Javascript循环队列类
需要滚动显示最多一定数量的信息,于弄了个这个 var LeesCircleQueue=function(size) { // 队列数组 var _queue=[]; // 队首索引 var _fron ...
- Extension method for type
扩展其实真的很简单 msdn是这样规定扩展方法的:"扩展方法被定义为静态方法,但它们是通过实例方法语法进行调用的. 它们的第一个参数指定该方法作用于哪个类型,并且该参数以 this 修饰符为 ...
- E8.Net工作流平台开发篇
E8.Net开发篇(一) E8.Net开发框架有哪些源程序模型? E8.Net开发框架为开发企业流程应用系统提供了最佳实践的开发架构.范例及源代码,包括待办事项的组织.流程启动模型.处理模型.母版 ...
- org.springframework.orm.jpa.JpaTransactionManager
[第九章] Spring的事务 之 9.2 事务管理器 ——跟我学spring3 http://sishuok@com/forum/blogPost/list/0/2503.html
- 【经验】angularjs 实现带查找筛选功能的select下拉框
一.背景 对于select的下拉列表,像国家选择这样的功能,全世界那么多国家,一直拉滚动条多辛苦,眼睛也要盯着找,累!so,为优化用户体验,带查找功能的下拉框是非常非常有必要的.都知道jquery里有 ...
- FastCGI中文规范
http://fuzhong1983.blog.163.com/blog/static/1684705201051002951763/ . 介绍 FastCGI是对CGI的开放的扩展,它为所有因特网应 ...
- 练习-libev和pyev示例
事件循环,IO复用,还是理解深刻一点好. 比较LIBEV和PYEV,发现PYTHON库只是对LIBEV作了简单的语法转换. 到了这个层次,就一个字:DIAO!!! libev的C版: #include ...