您正在查看 "模拟" 分类下的文章 2010-02-19 18:45 #include<iostream>
#include<algorithm>
using namespace std;
//纯模拟 不能越过敌人的棋子,总共有多少棋子,就作为这个方向的步长,结果按字典序输出
char a[10][10],ch;//ch代表枚举哪一方
int sum[8],len,cnt;
int dir[8][2]={{-1,-1},{-1,0},{-1,1},{0,1},{1,1},{1,0},{1,-1},{0,-1}};
typedef struct point
{
int x,y;
point(){};
point(int xx,int yy){x=xx;y=yy;}
bool op |
2010-02-05 12:56 #include<iostream>
#include<vector>
#include<cstdio>
#include<string>
using namespace std;
//枚举 通过枚举权重系数,问加拿大能不能赢
typedef struct country
{
int gold,silver,bronze;
string name;
}node;
node p;
vector<node>v;
int w[3];
int pow(int x,int y)//前一个是底数,后一个是指数
{
|
2010-01-21 16:41 #include<iostream>
using namespace std;
const int maxn=105;
//给定一个地图,然后给出n条信息,报告小偷的情况,最后问是否能确定小偷的行踪,包括已经逃亡
//城市只封锁t天
//那么我们正反各推导一次,说正向,如果(t,x,y)为1,那么不用考虑了,如果为0,考虑前1秒的4个方位,只要有一个为0
//那么这个状态也就为0
//只要某个时刻所有的格子都为1,那么说明小偷逃走了
//如果所有时刻都不止一个格子为0,则无从判断盗贼的位置,输出Nothing known.
//反之输出路线
int n |
2010-01-03 11:02 #include<iostream>
#include<cstdio>
#include<vector>
using namespace std;
const int INF=10000000;
//模拟 计算到下辆车来要等多久
int n,arive;
vector<int>v[20];
int a[20];
void slove()
{
int i,j,k,sum,ans=INF;
for(i=0;i<n;i++)
{
k=arive/a[i];
sum=k*a |
2009-12-23 16:53
http://acm.pku.edu.cn/JudgeOnline/problem?id=2961
#include
using namespace std;
//递归 采用补齐的方式,这题和HOJ 11584 I Speak Whales 很像,属于一个类型的
// 0 1
// 2 3
int H[2][2]={{1,1},{1,-1}};
int dfs(__int64 x,__int64 y)//y->i,x->j 画个图更清晰
{
if(x<2<2)return H[x][y];
__int64 i=0,j=0;
|
2009-12-12 17:16 #include<iostream>
#include<algorithm>
#include<cstdio>
#include<vector>
#include<cmath>
using namespace std;
//问题描述:直接说input把
//第一行输入test个数
//接下来是N和T,N代表电脑数,T代表执行了T秒
//接下来时K,S,K代表初始服务器个数,S代表文件数据大小,(注意:如果图中一个客户端下载满了,他也就变成了一个服务器)
//然后是个n*n矩阵,a[i][j]表示i到j传a[i][j]数据每秒
//接下来n行,描述n太电脑的上下线状态按时间升序给出
|
2009-12-12 17:15 #include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
//枚举
const int INF=INT_MAX;
int a[51][51],n,m,p,tx,ty;
bool use[51][51];
typedef struct node
{
int t,d,id,x,y;
}node;
node b[51];
bool cmp(node p1,node p2){return p1.t<p2.t;}
bool cmp1(node p1,node p2){return p1.id<p2.id;}
voi |
2009-08-09 0:15 #include<iostream>
using namespace std;
int n,m;
int a[51];//射程 大于等于这个射程才能看到
typedef struct Node
{
int x;//降落的时刻
int y;//起降的高度
}Node;
Node b[1001];
bool s[1001];
bool use[51];
bool cmp(Node t1,Node t2)
{
return t1.x+t1.y<t2.x+t2.y;
} |
2009-05-06 2:58 #include<iostream>
using namespace std;
//模拟题
int n,t;
int a[1001];
int main()
{
int i,j,r,id,max,num,k;
while(scanf("%d%d",&n,&t)!=EOF)
{
for(i=1;i<=n;i++)
{
scanf( |
2009-04-12 21:50 #include<iostream>
#include<stack>
using namespace std;
int d[16];//范围在-3和3之间
//恶心的模拟
int day;
int map[21][21];
int a[21][21];
int dx[4]={1,0,-1,0};
int dy[4]={0,-1,0,1};
char num[5]=".!X#";
bool check(int x,int y)
{
if(x>=0&&x<20&&y>=0&&y<20)return 1;
return 0;
}
int main()
{
|
| | |