摘要:
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1036我也不知道这题考查什么,感觉就是考细心。1.时间要能正确的读,输出的格式要对。2.结果要四舍五入。说一下四舍五入的方法,刚从别人那里学的。假设a为要舍入的数,res为结果。1.精确到个位。int res = a + 0.5;2.精确到小数点后第k位。double a, res, base;int k;double base = pow(10.0, k * 1.0);res = ((int)(a * base + 0.5)) / base;经简单测试,有效。PS:上面的高亮显示貌似有问题啊,ba 阅读全文
posted @ 2012-08-19 22:35
peaceful
阅读(161)
评论(0)
推荐(0)
摘要:
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1035稍微有点复杂,但是只要模拟出来应该就能过了。#include <iostream>using namespace std;class node{public: char instruct; int stepId;};const int SIZE = 12;char aLine[SIZE];node map[SIZE][SIZE];void move(int &curRow,int &curCol,char instruct){ switch (instruct) { 阅读全文
posted @ 2012-08-19 21:20
peaceful
阅读(116)
评论(0)
推荐(0)

浙公网安备 33010602011771号