C section 1.1 b
来源:互联网 发布:电信网络诈骗案例 编辑:程序博客网 时间:2024/05/01 17:19
http://a280606790.iteye.com/blog/770314
vim command
/*ID:XiaoLANG:C
TASK:ride
*/
#include<stdio.h>
#define M 6
int main(){
int i;
char one[M];
char two[M];
long temp1=1;
long temp2=1;
FILE *fin=fopen("ride.in","r");
FILE *fout=fopen("ride.out","w");
fscanf(fin,"%s",& *one);
fscanf(fin,"%s",& *two);
for(i=0;i<M;i++){
if (one[i]!=NULL)
temp1*=(one[i]-64);
else
continue;
if (two[i]!=NULL)
temp2*=(two[i]-64);
else
break;
}
if(temp1%47==temp2%47)
fprintf(fout,"%s\n","GO");
else
fprintf(fout,"%s\n","STAY");
return 0;
}
example;
#include <stdio.h>#include <ctype.h>int hash(char *s){ int i, h; h = 1; for(i=0; s[i] && isalpha(s[i]); i++) h = ((s[i]-'A'+1)*h) % 47; return h;}void main(void){ FILE *in, *out; char comet[100], group[100]; /* bigger than necessary, room for newline */ in = fopen("input.txt", "r"); out = fopen("output.txt", "w"); fgets(comet, sizeof comet, in); fgets(group, sizeof group, in); if(hash(comet) == hash(group)) fprintf(out, "GO\n"); else fprintf(out, "STAY\n"); exit (0);}
//after 23 submits this one finally works.
//char array and char string http://www.quanxue.cn/JC_CLanguage/CLang/Clang10.html
// the input and output file opening
// the byte of the number is not enough(maybe)
//http://stackoverflow.com/questions/7271939/declared-with-attribute-warn-unused-result
warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result
- C section 1.1 b
- C section 1.1 c
- C section 1.1 a
- B Conic Section
- C++——USACO Section 1.1 题解
- Section 1.1 Broken Necklace
- Section 1.1 Broken Necklace
- SICP section 1.1
- USACO Section 1.1 题解
- USCAO section 1.1 Transformations
- USACO Section 1.1
- Section 1.1 Broken Necklace
- Section 1.1 Broken Necklace
- [USACO Training] Section 1.1
- section
- Section()
- b、c
- C/B
- 2012-2-2 12:24:50 SSH,Update操作时报错缺少主键处理
- Kinect for windows SDK 正式版本抢先体验
- tomcat集群
- GlusterFS文档翻译 - GlusterFS Translators v1.3 中文化
- 如何自学java迅速成为java高手
- C section 1.1 b
- 为某航空公司设计一个出售机票程序,能根据月份和订票数决定优惠率,计算票价。
- 一道关于计算机系统和编译的问题
- RelativeLayout属性详解
- Java调用Native方法
- Fckeditor API 详解
- 第14周报告1 用递归函数求解表达式
- html frameset中的frame添加背景色
- java堆栈区别