您的位置:首页 > 其它

USACO Section1.1 TEXT Submitting Solutions

2016-05-27 22:46 218 查看
题目链接:http://train.usaco.org/usacotext2?a=Hh9AZgSTKZi&S=grade

题目:

The simplest programming challenge is named 'test' and requires you to read a pair of small integers from a single input line in the file 'test.in'
and print their sum to the file 'test.out'.

参考答案:

/*
<span style="font-family: Arial, Helvetica, sans-serif;">ID: your id here</span>
LANG: C
TASK: test
*/
#include <stdio.h>
#include <stdlib.h>
int main() {
FILE *fin = fopen("test.in", "r");
FILE *fout = fopen("test.out", "w");
int a, b;
fscanf(fin, "%d %d", &a, &b);	/* the two input integers */
fprintf(fout, "%d\n", a + b);
exit(0);
}
//在题目给出的范例答案中添加#include <stdlib.h>



                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: