2012年1月27日

UVA 11218 - KTV

摘要: brute force暴力枚举即可,位运算hash判重#include<stdio.h> int n,ans; int a[100],b[100],c[100],d[100],s[100]; void init(){ for(int i=1;i<=n;i++){ d[i]=(1<<a[i])+(1<<b[i])+(1<<c[i]); } } int main(){ int i,tm1,tm2; int ca=0; while(scanf("%d",&n)!=EOF && n){ ans=-1; f 阅读全文

posted @ 2012-01-27 22:45 c语言源码 阅读(221) 评论(0) 推荐(0) 编辑

UVA 321 - The New Villa BFS+位运算

摘要: 状态总数10*2^10=10240,hash判重即可注意点:在A房间不能关掉自己房间的灯(oh,my god,太伤了!)#include<stdio.h> #include<string.h> #include<queue> using namespace std; int r,d,s,sum; bool map[11][11],sw[11][11]; bool visit[11][1100]; int type[11][1100]; // move 1 on 2 off 3 int before[11][1100]; int beforestate[11] 阅读全文

posted @ 2012-01-27 22:43 c语言源码 阅读(312) 评论(0) 推荐(0) 编辑

1%与90%与信息技术素质

摘要: 今天是龙年的初五,也是我回学校的开学的第一天,在一片欢声笑语中我渡过了开学的第一课。 是啊,为什么要这么早就开学了!我们开学来了之后要干什么呢! 在开学的前一天,姐姐和妈妈也说,才回来这么几天,晚回去一两天也没有事。为什么要这么早就回去啊? 说实话,当时,妈妈和姐姐真得不想要我这么早就回学校。说,学习吧,不在乎这么几天,关键是学习的方法与效率。我当时,也说得不是太清楚,也只是说,我想早点回学校,多学习点东西,早点能挣上钱,这样就可以早点要爸爸妈妈过上好日子。 就在今天开会的时候,米老师也给我们算了一个账,让我们明白了我们学习一天的价值。同时, 我们也看到了,不只是我们不... 阅读全文

posted @ 2012-01-27 14:21 c语言源码 阅读(225) 评论(0) 推荐(0) 编辑

Codeforces Problem 37B - Computer Game

摘要: 按题目要求写就可以 #include<cstdio> #include<stdlib.h> #include<string.h> struct point{ int pow; int dmg; int num; }str[1010]; int visit[1010]; int ans1[1010],ans2[1010]; int cmp(const void *a,const void *b){ struct point *aa=(struct point *)a; ... 阅读全文

posted @ 2012-01-27 14:04 c语言源码 阅读(210) 评论(0) 推荐(0) 编辑

Codeforces Problem 51D - Geometrical problem

摘要: 从前三个数中找到公比(最多去掉一个数),检查后面数是否满足等比#include <stdio.h> #include <stdlib.h> #include <math.h> int in[100010]; int min(int a,int b){ return a>b?b:a; } int main(){ int i,j,k,n,p,ans; double d; scanf("%d",&n); for(i=1;i<=n;i++){ scanf("%d",&in[i]); } if(n== 阅读全文

posted @ 2012-01-27 14:01 c语言源码 阅读(142) 评论(0) 推荐(0) 编辑

导航