CONTEST ID : 1128 - 2023春-计导课设-9-12班-文件练习

文件操作练习。注意B题的读取不能用struct。
D和谐词汇的题,输入是若干字符串,不以空行结束. 所以 gets(line);    while (line[0]){... gets(line);}就会导致时间超限,代码在等空行,但in数据没有。应改为while(gets(line))。
/*文件练习B题. 读取一个包含7类数据的二进制文件,找到指定部分内容,并正确解释输出。
思路分析:主体框架是读取二进制文件,   while (fread(buffer, buffLen, 1, infile) > 0){...}
    因为二进制文件的记录长度是固定的,所以可以计算每条记录的长度,使用fseek直接定位到指定段;
    所以用fseek的话,实际只需要读一次就可以。
但是这道题的特殊之处在于,一条记录内是顺序包含7种类型数据,是分多次写入,因此带来的麻烦是
虽然每段内容结构相同,但不能用struct进行整块读取。
因为struct的成员之间有内存空隙;除非源文件本身是用struct格式写入才行。
    因此,可以直接定位,但必须分别读取,写出的代码冗长,且容易在变量名和输出格式上出错。
经测试,struct {含7种变量和数组}的长度为200, 但实际7种变量和数组的总长要小一些.
因此,可以直接定位,但必须分别读取,写出的代码冗长,且容易在变量名和输出格式上出错。
一种办法是:按总长度整块读取到字节数组中,然后再逐个定义对应类型的指针,按间接访问就可格式化解释输出。
例: char buffer[LEN];
int i=0; printf("%c\n", buffer[i]); i++;
short * hdPtr=&buffer[i];  printf("%hd\n", *hdPtr); i+=sizeof(short);
*/


SERVER TIME : 2025-09-19 23:34:07
Finished

STATUS : End    OPEN : Private
Start Time : 2023-03-20 20:00:00
End Time : 2023-05-04 23:59:00


Problem ID    User    Language    Result   

RunID User Nick Name Problem ID Result Memory Time Language Code Length Submit Time
9478920222112392022211239*Accepted67566
1192KB
10ms
C1562 bytes2023-04-25 18:54:53
9478220222112392022211239Runtime Error
1192KB
12ms
C1619 bytes2023-04-25 18:50:35
8715920222112392022211239Wrong Answer
5100KB
13ms
C1771 bytes2023-04-11 21:16:43
8715520222112392022211239Wrong Answer
1232KB
12ms
C1769 bytes2023-04-11 21:16:02
8715020222112392022211239Wrong Answer
1232KB
13ms
C1762 bytes2023-04-11 21:12:51
8714920222112392022211239Runtime Error
1232KB
5ms
C1759 bytes2023-04-11 21:12:32
8714620222112392022211239Runtime Error
1232KB
5ms
C1762 bytes2023-04-11 21:09:47
8714020222112392022211239Wrong Answer
1232KB
11ms
C1778 bytes2023-04-11 21:06:22
8713820222112392022211239Wrong Answer
1232KB
13ms
C1761 bytes2023-04-11 21:04:29
8713620222112392022211239Runtime Error
1196KB
12ms
C1760 bytes2023-04-11 21:03:31
8710820222112392022211239Output Limit Exceed
1196KB
6ms
C1832 bytes2023-04-11 20:38:55
8709220222112392022211239Output Limit Exceed
1196KB
9ms
C1832 bytes2023-04-11 20:26:18
8708720222112392022211239Output Limit Exceed
1196KB
7ms
C1830 bytes2023-04-11 20:22:52
8708020222112392022211239Output Limit Exceed
1196KB
5ms
C1830 bytes2023-04-11 20:20:16
8707820222112392022211239Output Limit Exceed
1232KB
7ms
C1831 bytes2023-04-11 20:19:50
8707620222112392022211239Output Limit Exceed
1584KB
6ms
C1832 bytes2023-04-11 20:19:24
8707420222112392022211239Output Limit Exceed
5100KB
7ms
C1833 bytes2023-04-11 20:18:58
8707120222112392022211239Output Limit Exceed
5100KB
8ms
C1828 bytes2023-04-11 20:17:02
8705320222112392022211239Output Limit Exceed
5100KB
6ms
C1831 bytes2023-04-11 20:11:58
8704920222112392022211239*Accepted64825
1200KB
13ms
C3566 bytes2023-04-11 20:08:49
8704420222112392022211239Output Limit Exceed
5100KB
7ms
C1828 bytes2023-04-11 20:05:12
8704020222112392022211239Output Limit Exceed
5100KB
7ms
C1828 bytes2023-04-11 20:00:53
8703720222112392022211239Output Limit Exceed
5100KB
7ms
C1832 bytes2023-04-11 20:00:06
8701520222112392022211239Wrong Answer
40256KB
13ms
C1731 bytes2023-04-11 19:47:16
8701020222112392022211239Runtime Error
1192KB
10ms
C1726 bytes2023-04-11 19:46:36
8700520222112392022211239Wrong Answer
1588KB
9ms
C1939 bytes2023-04-11 19:44:22
8700020222112392022211239Runtime Error
1196KB
8ms
C1935 bytes2023-04-11 19:41:32
8698720222112392022211239Runtime Error
1196KB
10ms
C2015 bytes2023-04-11 19:23:18
8698620222112392022211239Runtime Error
1196KB
9ms
C2015 bytes2023-04-11 19:22:47
8698420222112392022211239Runtime Error
1196KB
6ms
C2012 bytes2023-04-11 19:22:13
8582320222112392022211239Time Limit Exceed
1192KB
5287ms
C1741 bytes2023-04-09 18:59:18
8582220222112392022211239Compile Error
0KB
0ms
C1743 bytes2023-04-09 18:56:32