CONTEST ID : 1134 - 2023春-计导课设-转专业-文件练习

文件操作练习。注意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-22 02:50:53
Finished

STATUS : End    OPEN : Private
Start Time : 2023-03-24 12: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
7202320222120362022212036Wrong Answer
1192KB
12ms
C2313 bytes2023-03-28 21:31:56
7198920222120362022212036Wrong Answer
1192KB
10ms
C2272 bytes2023-03-28 21:21:25
7198320222120362022212036Wrong Answer
1192KB
13ms
C2269 bytes2023-03-28 21:19:14
719822022211480马耳东风Wrong Answer
1192KB
11ms
C2441 bytes2023-03-28 21:19:13
719732022211668字禹润Accepted
1192KB
11ms
C2335 bytes2023-03-28 21:17:46
719652022211480马耳东风Wrong Answer
1192KB
11ms
C2432 bytes2023-03-28 21:15:15
7196220222120362022212036Wrong Answer
1192KB
12ms
C2270 bytes2023-03-28 21:14:08
7194620222120362022212036Wrong Answer
1192KB
9ms
C2310 bytes2023-03-28 21:06:48
7193920222120362022212036Wrong Answer
1192KB
5ms
C2310 bytes2023-03-28 21:05:47
719292022211480马耳东风Wrong Answer
1192KB
10ms
C2267 bytes2023-03-28 21:03:39
7189920222120362022212036Wrong Answer
1192KB
13ms
C2255 bytes2023-03-28 20:49:45
7188820222120362022212036Wrong Answer
1192KB
10ms
C2256 bytes2023-03-28 20:44:03
718382022211480马耳东风Accepted
1192KB
11ms
C1324 bytes2023-03-28 20:13:01
718372022211480马耳东风Wrong Answer
1192KB
10ms
C1326 bytes2023-03-28 20:10:20
718352022211480马耳东风Wrong Answer
1192KB
10ms
C1326 bytes2023-03-28 20:09:52
718342022211480马耳东风Wrong Answer
1192KB
11ms
C1325 bytes2023-03-28 20:09:20
718322022211480马耳东风Wrong Answer
1192KB
12ms
C1324 bytes2023-03-28 20:08:07
718302022211480马耳东风Wrong Answer
1192KB
10ms
C1323 bytes2023-03-28 20:06:32
718292022211480马耳东风Wrong Answer
1192KB
12ms
C1323 bytes2023-03-28 20:06:01
718192022211480马耳东风Wrong Answer
1192KB
13ms
C1324 bytes2023-03-28 20:01:03
718052022211480马耳东风Wrong Answer
1192KB
12ms
C1290 bytes2023-03-28 19:54:40
717832022212511蔡逸文Accepted
1192KB
12ms
C2419 bytes2023-03-28 19:36:27
717782022212511蔡逸文Presentation Error
1192KB
9ms
C1844 bytes2023-03-28 19:31:54
7176020222120362022212036Wrong Answer
1192KB
9ms
C1788 bytes2023-03-28 19:12:48
717532022212511蔡逸文Wrong Answer
1192KB
7ms
C1725 bytes2023-03-28 19:07:01
7174920222120362022212036Wrong Answer
1192KB
10ms
C1784 bytes2023-03-28 19:01:18
7174720222120362022212036Wrong Answer
1192KB
11ms
C1802 bytes2023-03-28 19:00:32
715522022211480马耳东风Wrong Answer
1192KB
9ms
C1255 bytes2023-03-28 16:23:29
715102022212497xxAccepted
1192KB
10ms
C1150 bytes2023-03-28 15:55:49
714902022212511蔡逸文Wrong Answer
1192KB
11ms
C1501 bytes2023-03-28 15:43:40
710592022211698李佳伊Accepted
1068KB
12ms
C792 bytes2023-03-27 22:51:23
7105820222120362022212036Wrong Answer
1192KB
6ms
C1799 bytes2023-03-27 22:48:32
7105520222120362022212036Wrong Answer
1192KB
5ms
C1795 bytes2023-03-27 22:47:46
710122022211668字禹润Wrong Answer
1192KB
12ms
C2337 bytes2023-03-27 22:18:45
710082022211668字禹润Wrong Answer
1192KB
10ms
C2336 bytes2023-03-27 22:17:51
7100520222120362022212036Wrong Answer
1192KB
7ms
C1803 bytes2023-03-27 22:17:21
7098920222120362022212036Wrong Answer
1192KB
12ms
C1799 bytes2023-03-27 22:13:50
7098320222120362022212036Wrong Answer
1192KB
10ms
C1825 bytes2023-03-27 22:12:17
7098120222120362022212036Wrong Answer
1192KB
11ms
C1817 bytes2023-03-27 22:11:28
7097920222120362022212036Wrong Answer
1192KB
11ms
C1791 bytes2023-03-27 22:10:08
7097620222120362022212036Wrong Answer
1192KB
12ms
C1826 bytes2023-03-27 22:09:25
7097220222120362022212036Wrong Answer
1192KB
10ms
C1796 bytes2023-03-27 22:07:26
709542022211668字禹润Wrong Answer
1192KB
10ms
C2306 bytes2023-03-27 22:04:05
709482022211668字禹润Wrong Answer
1192KB
10ms
C2225 bytes2023-03-27 22:02:03
7086920222120362022212036Wrong Answer
1192KB
9ms
C1764 bytes2023-03-27 21:25:30
7085220222120362022212036Wrong Answer
1192KB
12ms
C1787 bytes2023-03-27 21:16:07
708342022211698李佳伊Wrong Answer
2048KB
13ms
C1711 bytes2023-03-27 21:07:45
708272022211698李佳伊Wrong Answer
2048KB
12ms
C1726 bytes2023-03-27 21:02:38
708052022211698李佳伊*Accepted64956
1192KB
10ms
C2211 bytes2023-03-27 20:51:54
7080120222120362022212036Wrong Answer
1192KB
8ms
C1775 bytes2023-03-27 20:51:18