摘要: [cce_cpp]#include <iostream>#include <algorithm>using namespace std;#ifndef ONLINE_JUDGE//最开始想用来练习spfa+邻接表,老是wa,改用floyd + 邻接矩阵,还是wa,最后无奈看了discuss,//才发现忘记判断起点与终点相同的情况...#include <fstream>ifstream fin("test.txt");#define cin fin#endifconst int INF = 99999999;int graph[220][ 阅读全文
posted @ 2013-05-19 12:28 see_why 阅读(246) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <fstream>using namespace std;#ifndef ONLINE_JUDGEifstream fin("test.txt");#define cin fin#endifint bin[1010];int findx(int x){ int r = x; while(bin[r] != r) { r = bin[r]; } return r;}void merge(int x,int y){ bin[x] = y;}int main(){ int n,m,a,b... 阅读全文
posted @ 2013-02-04 21:22 see_why 阅读(176) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>using namespace std;int main(){ long long n,m,i,mul; while(cin >> n >> m) { mul = 1; m = m % 4; //找规律,一个数的n次方。。它的个位数四次一循环 if(!m) m += 4; for(i = 0 ; i < m ; ++i) { mul = mul * n % 10; } cout << mul ... 阅读全文
posted @ 2013-01-28 20:36 see_why 阅读(137) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <algorithm>using namespace std;struct hotel{ int num; int room_num; int price;};bool cmp(hotel a,hotel b) //先按价格升序,再按房间数升序,最后按编号{ if(a.price != b.price) return a.price < b.price; else if(a.room_num != b.room_num) return a.price < b.price; else ... 阅读全文
posted @ 2013-01-28 20:32 see_why 阅读(120) 评论(0) 推荐(0) 编辑
摘要: //杭电的一道月赛题,当时也做过了//第一次提交用c++写,虽然过了,但感觉效率好低,然后用c重写了一遍。。。#include <stdio.h>#include <string.h> int main(){ char a[100]; int p,d,n,x,sum,m; scanf("%d",&p); while(p--) { sum = 0; scanf("%d",&d); getchar(); gets(a); scanf("%d",&n); printf("%d &qu 阅读全文
posted @ 2013-01-25 22:22 see_why 阅读(236) 评论(0) 推荐(0) 编辑
摘要: Tree SummingBackgroundLISP was one of the earliest high-level programming languages and, with FORTRAN, is one of the oldest languages currently being used. Lists, which are the fundamental data structures in LISP, can easily be adapted to represent other important data structures such as trees.This 阅读全文
posted @ 2013-01-25 16:27 see_why 阅读(231) 评论(0) 推荐(0) 编辑
摘要: Ignatius and the Princess IITime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3027Accepted Submission(s): 1818Problem DescriptionNow our hero finds the door to the BEelzebub feng5166. He opens the door and finds feng5166 is about to kill our pretty P 阅读全文
posted @ 2013-01-24 17:00 see_why 阅读(168) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <cstring>using namespace std;const int MAXD = 20; int s[1<<MAXD];//左位移,表示2的MAXD次方int main(){ int D,I; while(cin >> D >> I) { memset(s,0,sizeof(s)); int k,n = (1<<D)-1; //n是最大节点编号 for(int i = 0; i < I; ++i) { k = 1; ... 阅读全文
posted @ 2013-01-21 21:13 see_why 阅读(235) 评论(0) 推荐(0) 编辑
摘要: Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 11054Accepted Submission(s): 4168Problem Description今天的上机考试虽然有实时的Ranklist,但上面的排名只是根据完成的题数排序,没有考虑每题的分值,所以并不是最后的排名。给定录取分数线,请你写程序找出最后通过分数线的考生,并将他们的成绩按降序打印。Input测试输入包含若干场考试的信息。每场考试信息的第1行给出考生人数N ( 0 < N 阅读全文
posted @ 2013-01-21 20:50 see_why 阅读(171) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>using namespace std;void print_permutation(int n,int * A,int cur){ int i,j; if(cur == n) //递归边界 { for(i = 0; i < n; ++i) cout << A[i] << ' '; cout << endl; } else for(int i = 1; i <= n; ++i) //尝试在A[cur]中填各种整数i { int ok = 1; for... 阅读全文
posted @ 2013-01-21 20:33 see_why 阅读(160) 评论(0) 推荐(0) 编辑