随笔分类 - ACM — 模拟题
摘要:这题是一个字符串模拟水题,给12级学弟学妹们找找自信的,嘿嘿;题目意思就是要你讲身份证的上的省份和生日解析出来输出就可以了:http://acm.hdu.edu.cn/showproblem.php?pid=2629 1 #include 2 #include 3 using namespace std; 4 int main() 5 { 6 int n,t; 7 string home,a; 8 cin>>n; 9 for(int k = 0 ; k >a;12 t = (a[0]-'0')*10+a[1]-'0';13 s...
阅读全文
摘要:http://www.bnuoj.com/bnuoj/problem_show.php?pid=4207【题意】:中文题,略【题解】:模拟【code】: 1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 struct Nod 8 { 9 int t,sh; 10 }node[3][10]; 11 12 void init() 13 { 14 //XsugarX 15 node[0][0].t = 15; 16 node[0][0].sh = 650; 17 ...
阅读全文
摘要:http://www.bnuoj.com/bnuoj/problem_show.php?pid=33648【题解】:结果先对MOD*2取模,才能得到结果是否是正确的奇偶问题,得到最后结果之后再对MOD取模。。。【code】: 1 #include 2 #include 3 #include 4 #include 5 #include 6 7 using namespace std; 8 #define MOD 1000000007 9 10 struct Nod11 {12 int parent;13 long long sum;14 int edge;15...
阅读全文
摘要:http://www.bnuoj.com/bnuoj/problem_show.php?pid=29368【题解】:模拟,然后对x,进行枚举,看是否所有都满足条件【code】: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 9 using namespace std; 10 11 12 double stack[1000]; 13 int s_cnt; 14 15 double fabs(double a) 16 { 17 return...
阅读全文
摘要:http://www.bnuoj.com/bnuoj/problem_show.php?pid=29373【题意】:模拟光标输入【题解】:用双向列表模拟实现,这里用其他模拟会超时,注意内存的释放【code】: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 9 using namespace std;10 11 struct Nod12 {13 char ch;14 Nod * second;15 Nod * first;16 Nod()...
阅读全文
摘要:http://www.bnuoj.com/bnuoj/problem_show.php?pid=1057【题意】:给定x的值,带入f(x)求函数值【题解】:注意第一个数的符号可能是'+',这里把我坑死了。。。【code】: 1 #include 2 #include 3 #include 4 #include 5 #include 6 7 using namespace std; 8 9 char str[100000],tstr[1000];10 int stack[10000];11 void init()12 {13 int i;14 for(i=0;i='...
阅读全文
摘要:http://www.bnuoj.com/bnuoj/problem_show.php?pid=27987【题意】:给定坐标输出图形【题解】:处理坐标上的小技巧【code】: 1 #include 2 #include 3 #include 4 #include 5 6 using namespace std; 7 8 #define N 100 9 10 char str[N*3][N*3];11 12 void init()13 {14 int i,j;15 for(i=0;ix) x1=x;50 if(y1>y) y1=y;51 ...
阅读全文
摘要:http://www.bnuoj.com/bnuoj/problem_show.php?pid=20838【题意】: 有点长,略。【code】: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 8 using namespace std; 9 10 double rat[220][220];11 double drat[220][220];12 13 struct Nod14 {15 int id;16 double rt;17 }node[220];18 19 int ...
阅读全文
摘要:http://www.bnuoj.com/bnuoj/problem_show.php?pid=20832【题意】:给你一串字符串,求一个ST(0 2 #include 3 #include 4 #include 5 #include 6 #include 7 8 using namespace std; 9 10 int getST(char *names)11 {12 int a[100];13 int len = strlen(names);14 int i;15 int ST;16 int b[1000],cnt=0;17 f...
阅读全文
摘要:http://www.bnuoj.com/bnuoj/problem_show.php?pid=4352【题意】:给你个长串,输出该长串中能第一放出的技能,每个技能有对应的一个小子串,不能放出任何技能输出“Nothing Happened”【题解】:暴力匹配(数据量不大),若数据量巨大,则得用ac自动机解【code】: 1 #include 2 #include 3 #include 4 #include 5 6 using namespace std; 7 #define INF 1e9 8 9 struct Nod10 {11 char str1[40];12 ...
阅读全文
摘要:题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=4740【题意】: 森林里有一只驴和一只老虎,驴和老虎互相从来都没有见过,各自自己走过的地方不能走第二次,都会朝着一个方向走,直到这个方向不能走,然后转向,驴只会右转,老虎只会左转,当转过一次之后还是不能往前走,那么它就停下来不再移动了。。。问驴和老虎是否能相遇在一个坐标点。。。【题解】: 暴力搜索,模拟过程就能过,不存在超时问题【code】: 1 /* 2 JudgeStatus:Accepted time:15MS 3 Memory:4212K codeLenght:2591B...
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=4706【题目大意】: 用a-z排出N的形状,输出大小为3-10的N,如果超过z之后,重新从a开始下面是大小为3的N(其实这里的N是反的,呵呵)a ebdfc g大小为4的Nh ni mojl pk q【code】: 1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 char str[11][11][11]; 8 int cnt; 9 10 void solve(int id)11 {12 int n=id,i;13 ...
阅读全文

浙公网安备 33010602011771号