hdu_1033(我怎么找到的这么水的题,只为保存代码。。。)
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
const int Max = ;
int ansx[Max],ansy[Max];
//0,1,2,3表示方向,顺时针标注
void ans(int tx,int ty, int dir,int id)
{
if(dir == ){
ansx[id+] = tx+;
ansy[id+] = ty;
}
else if(dir == ){
ansx[id+] = tx;
ansy[id+] = ty+;
}
else if(dir == ){
ansx[id+] = tx-;
ansy[id+] = ty;
}
else if(dir == ){
ansx[id+] = tx;
ansy[id+] = ty-;
}
}
int main()
{
int dir = ;
char query[Max];
while(~scanf("%s",query))
{
dir = ;
ansx[] = ,ansy[] = ;
int len = strlen(query);
for(int i = ; i < len; i++)
{
if(query[i]=='V') {
dir = (dir+)%;
ans(ansx[i],ansy[i],dir,i);
}
else if(query[i]=='A'){
dir = (dir+)%;
ans(ansx[i],ansy[i],dir,i);
}
}
printf("300 420 moveto\n");
for(int i = ; i <= len; i++){
printf("%d %d lineto\n",ansx[i],ansy[i]);
}
printf("stroke\nshowpage\n");
}
return ;
}
hdu_1033(我怎么找到的这么水的题,只为保存代码。。。)的更多相关文章
- 通过 thread dump 分析找到高CPU耗用与内存溢出的Java代码
http://heylinux.com/archives/1085.html通过 thread dump 分析找到高CPU耗用与内存溢出的Java代码 首先,要感谢我的好朋友 钊花 的经验分享. 相信 ...
- 8.2/baltic神(水)题
summary:10 bzoj1334: Description N个政党要组成一个联合内阁,每个党都有自己的席位数. 现在希望你找出一种方案,你选中的党的席位数要大于总数的一半,并且联合内阁的席位数 ...
- 【Richard 的刷(水)题记录】
大概想了想,还是有个记录比较好. 9/24 网络流一日游: 最大流:bzoj1711[Usaco2007 Open]Dining 拆点 BZOJ 3993 Sdoi2015 星际战争 二分 P.S.这 ...
- mysql练习题目试水50题,附建库sql代码
如果你没试过水的话,那一题一题地每一题都敲一遍吧.不管它们对你看来有多么简单. 建库代码 部分题目答案在末尾,可用ctrl f 搜索题号. 作业练习——学生-选课 表结构 学生表: Student ...
- 我的CodeF水A题之路
Codeforces Round #359 (Div. 2) A. Free Ice Cream 题目链接:http://www.codeforces.com/problemset/problem/6 ...
- codevs 1360 xth砍树 线段树不能再水的题了
连标记都不用打.. #include<cstdio> #include<cstring> #include<algorithm> using namespace s ...
- 【CodeForces 602B】G - 一般水的题2-Approximating a Constant Range
Description When Xellos was doing a practice course in university, he once had to measure the intens ...
- 【CodeForces 604B】F - 一般水的题1-More Cowbe
Description Kevin Sun wants to move his precious collection of n cowbells from Naperthrill to Exeter ...
- 【CodeForces 596A】E - 特别水的题5-Wilbur and Swimming Pool
Description After making bad dives into swimming pools, Wilbur wants to build a swimming pool in the ...
随机推荐
- Swift基础学习
Swift基础学习 http://c.biancheng.net/cpp/html/2242.html 这个网站最近看了一下,对于基本语法解释概括的相对全面,如同重新练习一遍OC似的,挺全面的,谢谢 ...
- [Maven] Missing artifact
今天从朋友那拷过来一个maven工程,eclipse中maven配置好了,maven仓库也配置完毕,但是一直报Missing artifact,然后开网执行maven update,下载完jar后,还 ...
- kafka副本机制之数据可靠性
一.概述 为了提升集群的HA,Kafka从0.8版本开始引入了副本(Replica)机制,增加副本机制后,每个副本可以有多个副本,针对每个分区,都会从副本集(Assigned Replica,AR)中 ...
- LAMP第三部分php,mysql配置
php配置 1. 配置disable_functiondisable_functions = eval,assert,popen,passthru,escapeshellarg,escapeshell ...
- Linux(CentOS6.5_X86.64)编译libjpeg出现“checking host system type... Invalid configuration `x86_64-unknown-linux-gnu': machine `x86_64-unknown' not recognized”的解决
本文地址http://comexchan.cnblogs.com/,作者Comex Chan,尊重知识产权,转载请注明出处,谢谢! 今天在编译libjpeg 的时候,遇到下面的报错: checki ...
- Git详解之八:Git与其他系统
Git 与其他系统 世界不是完美的.大多数时候,将所有接触到的项目全部转向 Git 是不可能的.有时我们不得不为某个项目使用其他的版本控制系统(VCS, Version Control System ...
- MySQL数据库学习: 01 —— 数据库的概述
壹 概述 一 了解SQL 1.1 数据库基础 1.1.1 什么是数据库 数据库(database)保存有组织的数据的容器(通常是一个文件或一组文件). 易混淆:人们常常用“数据库”这个词语来代表他们使 ...
- Layout 不可思议(二)—— 两侧定宽的三列布局
三列布局作为网页设计中最常见的布局,其实现方法早已被诸位前端大神摸透 网上相关的文章很多,原本已无必要再做赘述 不过既然开了 Layout 系列,三列布局就是必修课 本文整理了一些常用的实现方法,然后 ...
- Hyper-V 虚拟网络设置
目标:搭建一个主机上的网络用来链接主机和虚拟机,并且虚拟机可以通过主机上网. 步骤一:创建一个Internal Network. 步骤二: 创建虚拟机并设置Virtual Switch. 步骤三:将上 ...
- 纯前端导出pdf文件
纯前端js导出pdf,已经用于生产环境. 工具: 1.html2canvas,一种让html转换为图片的工具. 2.pdfmake或者jspdf ,一种生成.编辑pdf,并且导出pdf的工具. pdf ...