zoukankan      html  css  js  c++  java
  • 【USACO】初次尝试的错误your ride is here超时

    d首次尝试usaco的代码,第一题,就给我个超时的错误,应该是在文件哪里用时太多

    下面为错误代码及出错情况,留作纪念。             time :2012.10.9

    /*
     ID:ly-meng2
     LANG: C
     TASK: ride
     */
     #include <stdio.h>
     #include<stdlib.h>
     #include<string.h>
     #define Max 10
     
     int turn(char i){
     	if('a'<=i&&i<='z')
     		return i-'a'+1;
     	else
     		return i-'A'+1;
     }
     
     int GetMod(char *s){
     	int count;
     	int sb=1;
     	while(s[count]!='\0'){
     		sb*=turn(s[count]);
     	}
     	return sb%47;
     }
     int main () {
         FILE *fin  = fopen ("ride.in", "r");
         FILE *fout = fopen ("ride.out", "w");
         
     
         char get1[Max];
         char get2[Max];
     
         while(1){
         fscanf(fin,"%s",&get1);
         fscanf(fin,"%s",&get2);
     
         if(GetMod(get1)==GetMod(get2))
         	fprintf(fout,"GO\n");
         else
         	fprintf(fout,"STAY\n");
     
     
         return 0;
         }
     
     }
     
    

      

     

    转载文章请注明出处: http://www.cnblogs.com/menglei/
  • 相关阅读:
    jdbc练习demo
    需登录账号与密码的网页爬取demo
    获取中文的首字母demo
    短信发送接口demo
    读取配置文件工具demo
    省选模拟96
    省选模拟95
    省选模拟94
    省选模拟92
    省选模拟91
  • 原文地址:https://www.cnblogs.com/menglei/p/2716802.html
Copyright © 2011-2022 走看看