模拟_模拟迷宫走势(HDU_4740)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=4740 #include #include #define M 1005int n;int Dx,Dy,Ds,Gx,Gy,Gs;int Df[M][M],Gf[M][M];const int move[4][2] = {{0,1},{1,0},{0,-1},{-1,0}};int judEdge(int x, int y){ if(x = n || y = n) return 0; return 1;}void Dturn(){ Ds = (Ds + 1) % 4;}void Gtu...
阅读全文
posted @
2013-10-06 17:20
lk1993
阅读(298)
推荐(0)
模拟_模拟makefile文件(HDU_4724)
摘要:这题坑爹,说好的五百组呢?There are at most 500 target in the Makefile. !!!!!If You Know This,You Must Have NO GFhttp://acm.hdu.edu.cn/showproblem.php?pid=4724#pragma warning(disable : 4786)#include #include #include #include using namespace std;typedef string String;#define M 5050map Com;set haveFile;set fileLi
阅读全文
posted @
2013-09-12 10:28
lk1993
阅读(289)
推荐(0)
模拟_简单模拟处理边界(HDU_2525)
摘要:这题做起来有些烦躁,可能是题意没有理解清楚吧。题意:造出来的士兵第一天没有攻击力,但可以采样,且要消耗一天的生命,共 d 天生命。造一个士兵需要 k 天,k + 1 天时可以有攻击力,造到 k 天时相当于成活士兵的第一天。刚开始的士兵为第一天的士兵,没有攻击力,但可以采样。总共模拟 x 天。数据较大,采用 __int64。ps: 这题应该有数学公式,但难的推导,直接模拟了。#include #include #define M 102int n,d,k,a,x;__int64 live[M],grow[M],all;void add_day(){ __int64 A = 0; li...
阅读全文
posted @
2013-08-15 09:27
lk1993
阅读(208)
推荐(0)
模拟_大数(HDU_1715)
摘要:#include #include #define M 1002char map[M][220] = {"0","1","1"};void add(char *aStr, char *bStr, char *cStr)//aStr + bStr = cStr{ int ai = strlen(aStr)-1,bi = strlen(bStr)-1,ci = 0; int all,over = 0; for(; ai>=0 || bi>=0; ai--,bi--) { all = (ai>=0 ? aStr[ai]-&
阅读全文
posted @
2013-08-13 13:30
lk1993
阅读(176)
推荐(0)
模拟_大数JAVA(HDU_1063)
摘要:while(sc.hasNext()) {} 多案例stripTrailingZeros() 去除后导零toPlainString() 变换到 String 中,防止以科学计数输出import java.math.*;import java.util.*;public class Main{ public static void main(String[] args) { BigDecimal a; int n; String p; Scanner sc = new Scanner(System.in); ...
阅读全文
posted @
2013-08-08 16:47
lk1993
阅读(180)
推荐(0)
模拟_预处理(HDU_2132)
摘要:注意 i*i*i 会越界,应定义为 __int64#include #include #define M 100002__int64 map[M] = {0,1};void init(){ for(__int64 i=2; i=0) { printf("%I64d\n",map[n]); } return 0;}
阅读全文
posted @
2013-07-31 19:16
lk1993
阅读(111)
推荐(0)
模拟_大数字符串(HDU_2054)
摘要:这道题以前写过,代码啰嗦,现重写特殊情况:1: 000 0000002: +000 -000003:000.00000 -000.000004:+000.00000 -000.000005: 0000123.4560000 -123.456。。。。。#include #include #define M 100000char A[M],B[M];void conv(char *&pD){ char flag = '*'; if(*pD == '+' || *pD == '-') { flag = *pD; pD++; } while(*p
阅读全文
posted @
2013-07-31 10:50
lk1993
阅读(168)
推荐(0)