USACO Section1.1 TEXT Submitting Solutions

来源:互联网 发布:面板数据到底是怎样的 编辑:程序博客网 时间:2024/05/22 13:40

题目链接: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: CTASK: 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>



0 0
原创粉丝点击