Read topic
为什么我的代码Restricted Function???
2012-01-23 01:14:04 iphxer
#include<iostream>
#include<map>
#include<cstdio>
using namespace std;
struct point{
int a,b;
}tab[10010],e;
bool operator<(const point &p1,const point& p2)
{
if(p1.a<p2.a)return 1;
else if(p1.a==p2.a)return p1.b<p2.b;
return 0;
}
int dir[5][2]={0,0,0,1,0,-1,1,0,-1,0};
int main()
{
freopen("in.txt","r",stdin);
int a,b,n;
int t=0;
while(scanf("%d%d%d",&n,&a,&b)!=EOF){
if(a+b+n==0)break;
map<point,int> m;
for(int i=0;i<n;i++)scanf("%d%d",&tab[i].a,&tab[i].b);
for(int i=0;i<n;i++){
for(int j=0;j<5;j++){
e.a=tab[i].a+dir[j][0];
e.b=tab[i].b+dir[j][1];
m[e]++;
}
}
int c=0;
for(int i=0;i<n;i++)if(m[tab[i]]<3)c++;
printf("Case %d: %d\n",++t,c);
}
}
去掉 freopen 也是这样
2012-01-23 01:15:40 iphxer
去掉 freopen 也是这样
Reply
|