- 博客(34)
- 收藏
- 关注
原创 1A--Theatre Square
注意:64位. #include #include using namespace std; int main() { unsigned long long n,m,a; cin >> n >> m >> a; unsigned long long lennumber,widnumber; if(n % a == 0) lennumber =
2014-07-31 19:39:06 284
原创 csu1256
1256: 天朝的单行道 Time Limit: 1 Sec Memory Limit: 128 MB Submit: 169 Solved: 50 [Submit][Status][Web Board] Description 在另一个平行宇宙中,有一个神奇的国度名叫天朝。天朝一共有N个城市(标号分别为1, 2, …, N),M条道路,为了方便交通管制,天朝的M
2014-07-31 17:01:35 347
原创 hdu2503
map的应用。输入一个字典,字典格式为“英语à外语”的一一映射关系。 然后输入若干个外语单词,输出他们的 英语翻译单词,如果字典中不存在这个单词,则输出“eh”。
2014-07-30 23:42:53 368
原创 hdu1004
map的在acm中应用。 Map 简介: map是一类关联式容器。它的特点是增加和删除节点对迭代器的影响很小,除了那个操作节点,对其他的节点都没有什么影响。对于迭代器来说,可以修改实值,而不能修改key。
2014-07-30 18:28:59 369
原创 hdu1698
线段树的应用。 #include #include #include using namespace std; int sum[400020],setv[400020]; int _sum; void build(int rt,int L,int R) { if(L == R) sum[rt] = 1; else { int M = (L +
2014-07-30 16:48:53 301
原创 hdu1754
线段树的应用 #include #include #include #include #define maxx 200003 using namespace std; int cat[4 * maxx],N,F,p,v,ql,qr; void update(int r,int L,int R) { int mid = (L + R) / 2; if(L == R)
2014-07-29 23:37:37 280
原创 hdu1711
numbersequence #include #include using namespace std; int a[1000002],b[10002],n,m; int next[10002]; void getnext(int *s,int *next) { next[0] = next[1] = 0; for(int i = 1;i < m;i ++)
2014-07-26 21:40:26 291
原创 poj3984
用BFS做, #include #include using namespace std; struct node { int x,y,pre; }dog[110]; int cat[110][110]; int rabbit[4][2] = {{1,0},{0,1},{-1,0},{0,-1}}; void print(int i) { if(dog[i].pr
2014-07-26 20:04:39 360
原创 hdu1575
矩阵快速幂的应用,先定义一个结构体,定义矩阵和矩阵乘法,方便以后直接调用,再写一个矩阵快速幂的函数,进行相关运算。其实对于比较大的指数运算时,快速幂的优势是很明显的,时间复杂度降低到很小。 #include #include #include #define mode 9973 using namespace std; int n; struct matrix { int ma
2014-07-26 13:40:47 417
原创 csu1340
#include using namespace std; int main() { int t; cin>>t; while(t--) { int a; bool lucky=false; cin>>a; while(a) { if(a%10==7)lucky=true; a/=10; } cout<<(lucky?"Lucky":"Unlucky")<<'\n'; } return 0; }
2014-07-20 21:04:01 313
原创 csu1468
#include using namespace std; int main() { int T,t0 = 0; int N,L; cin >> T; if((T >= 1) && (T <= 200)) { while(t0 < T) { cin >> N >> L; i
2014-07-20 21:03:51 317
原创 csu1284
#include #include using namespace std; int main() { int T,t0 = 0; int N; cin >> T; if((T >= 1) && (T <= 100)) { while(t0 < T) { cin >> N;
2014-07-20 21:01:38 255
原创 csu1178
#include #include using namespace std; int main() { char *p = new char[1000000]; int t1 = 0,t2 = 0,t3 = 0; while(cin >> p) { int t = strlen(p); if(t < 1000000)
2014-07-20 20:59:39 295
原创 csu1160
#include using namespace std; int main() { int x; int p[8]; while(cin >> x) { if((x >= 0) && (x <= 2147483648)) { for(int i = 0;i < 8;i ++) {
2014-07-20 20:57:39 406
原创 CSU1003
#include using namespace std; int main() { int T,t0 = 0; int n = -1; int jingyan = 0; cin >> T; if((T > 0) && (T < 120)) { while(t0 < T) { int t = 0; cin >> n; if((n >= 0) && (n <
2014-07-20 20:53:03 296
原创 csu1018
#include using namespace std; int main() { int T,t0 = 0; int a,b,c; int t1 = 0,t2 = 0,t3 = 0,t4 = 0; cin >> T; while(t0 < T) { cin >> a >> b; if((a > 0) && (
2014-07-20 20:52:47 284
原创 poj1915
#include #include using namespace std; int x1,y1,x2,y2,m,chess[310][310],chess2[310][310]; int knightx[8] = {1,1,-1,-1,2,2,-2,-2}; int knighty[8] = {2,-2,2,-2,1,-1,1,-1}; void bfs() { memset(ches
2014-07-20 20:47:19 345
原创 poj1006
#include using namespace std; int f(int p,int e,int i ,int d); int main() { int p,e,i,d; for(int t = 1;;t++) { cin >> p >> e >> i >> d; if((p >= 0)&&(e >= 0)&&(i >=0)&&(
2014-07-20 20:42:47 300
原创 poj1007
#include using namespace std; int main() { int n,m; cin >> n >> m; char **p; p = new char *[m]; for(int i = 0;i < m;i ++) p[i] = new char [n]; for(int row = 0;row <
2014-07-20 20:42:10 302
原创 poj1004
#include using namespace std; int main() { double account,averge,amount = 0; int t = 1; while(t <= 12) { cin >> account; amount = amount + account
2014-07-20 20:38:21 354
原创 poj1005
#include #include #define pi 3.1415926 using namespace std; int f(float x,float y); int main() { int N; float x,y; cin >> N; for(int t = 1;t <= N;t++) { cin >> x >> y;
2014-07-20 20:37:18 351
原创 poj1003
#include using namespace std; int main(void) { double t, c; while(cin >> t && t) { if((t>0.01)&&(t<=5.20)) { int t1 = (int)(t * 10) % 10; int t2 = (int)(t * 100
2014-07-20 20:37:03 289
原创 poj1458
Common Subsequence Time Limit:1000MS Memory Limit:10000K 最长公共子序列,注意状态方程的确立,在求dp的两个for循环中,逐次求出应有的解,注意状态转移过程,最后求出应有的解。 #include #include #include using namespace std; int dp[1000][1000]; char cat
2014-07-17 23:05:12 291
原创 poj1837
#include #include using namespace std; int dp[21][15001]; int main() { int a,b; int num1[21]; int num2[21]; cin >> a >> b; for(int i = 1;i cin >> num1[i];
2014-07-15 22:21:23 285
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人