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-21 03:49:18
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
1001952019211417咸鱼Output Limit Exceed
1192KB
7ms
C1880 bytes2023-05-02 16:26:56
1001932019211417咸鱼Wrong Answer
1192KB
11ms
C1880 bytes2023-05-02 16:26:33
1001922019211417咸鱼*Accepted64826
1192KB
12ms
C1925 bytes2023-05-02 16:24:19
1001902019211417咸鱼*Accepted64826
1192KB
11ms
C2302 bytes2023-05-02 16:23:34
1001832019211417咸鱼*Accepted64826
1192KB
12ms
C2781 bytes2023-05-02 16:22:23
1001812019211417咸鱼Wrong Answer
1200KB
11ms
C2614 bytes2023-05-02 16:20:52
1001772019211417咸鱼*Accepted65208
1200KB
13ms
C2251 bytes2023-05-02 16:16:38
1001742019211417咸鱼Runtime Error
1072KB
6ms
C3992 bytes2023-05-02 16:15:53
1001732019211417咸鱼Runtime Error
1072KB
8ms
C3992 bytes2023-05-02 16:15:26
1001652019211417咸鱼Output Limit Exceed
1068KB
10ms
C1997 bytes2023-05-02 16:10:02
1001622019211417咸鱼Wrong Answer
1192KB
59ms
C2685 bytes2023-05-02 16:07:52
1001572019211417咸鱼Wrong Answer
1068KB
12ms
C1396 bytes2023-05-02 16:05:23
998872022211644appleAccepted
1068KB
10ms
C855 bytes2023-05-02 01:00:09
998442022211644appleAccepted
2052KB
14ms
C1773 bytes2023-05-01 23:09:17
998412022211644appleOutput Limit Exceed
2052KB
16ms
C1760 bytes2023-05-01 23:06:27
993612022211644appleAccepted
1192KB
12ms
C1817 bytes2023-05-01 10:19:31
993542022211644apple*Accepted96373
1196KB
13ms
C1515 bytes2023-05-01 10:04:42
993482022211644appleWrong Answer
1196KB
12ms
C1534 bytes2023-05-01 09:31:28
993452022211644appleWrong Answer
1196KB
9ms
C1481 bytes2023-05-01 09:26:26
993432022211644appleWrong Answer
1192KB
11ms
C1483 bytes2023-05-01 09:26:00
993422022211644appleWrong Answer
1196KB
10ms
C1471 bytes2023-05-01 09:24:11
993412022211644appleWrong Answer
1196KB
12ms
C1327 bytes2023-05-01 09:20:54
993362022211644appleWrong Answer
1192KB
10ms
C1302 bytes2023-05-01 09:08:53
993342022211644appleWrong Answer
1192KB
13ms
C1329 bytes2023-05-01 09:07:03
993222022211644appleAccepted
1192KB
10ms
C2835 bytes2023-05-01 01:00:43
993182022211644appleWrong Answer
1192KB
10ms
C2843 bytes2023-05-01 00:56:37
993172022211644appleRuntime Error
1192KB
8ms
C2930 bytes2023-05-01 00:55:18
992962022211644appleWrong Answer
1192KB
12ms
C2787 bytes2023-05-01 00:21:15
992952022211644appleWrong Answer
1192KB
13ms
C2793 bytes2023-05-01 00:19:54
992942022211644appleWrong Answer
1192KB
11ms
C2778 bytes2023-05-01 00:18:48
989522022211644appleWrong Answer
1192KB
9ms
C1786 bytes2023-04-30 22:24:31
989352022211644apple*Accepted64610
1192KB
9ms
C2959 bytes2023-04-30 22:20:33
989142022211644appleWrong Answer
1192KB
8ms
C1784 bytes2023-04-30 22:14:11
989052022211644appleWrong Answer
1192KB
11ms
C1771 bytes2023-04-30 22:11:31
988912022211644appleWrong Answer
1192KB
10ms
C1784 bytes2023-04-30 22:06:51
988862022211644appleWrong Answer
1192KB
9ms
C1783 bytes2023-04-30 22:05:18
988842022211644appleWrong Answer
1192KB
7ms
C1766 bytes2023-04-30 22:04:38
988612022211644appleWrong Answer
1192KB
10ms
C1777 bytes2023-04-30 21:56:30
988342022211644appleWrong Answer
1192KB
8ms
C1763 bytes2023-04-30 21:50:18
988312022211644appleWrong Answer
1192KB
9ms
C1764 bytes2023-04-30 21:48:33
988192022211644appleWrong Answer
1192KB
9ms
C1763 bytes2023-04-30 21:41:34
988112022211644appleWrong Answer
1192KB
10ms
C1758 bytes2023-04-30 21:37:41
984702022212247马梓洋Wrong Answer
1068KB
10ms
C957 bytes2023-04-30 17:49:48
984692022212247马梓洋*Accepted64826
1192KB
12ms
C1359 bytes2023-04-30 17:48:53
984672022212247马梓洋Runtime Error
1192KB
10ms
C1359 bytes2023-04-30 17:47:14
968172022212458谭超Wrong Answer
1068KB
10ms
C943 bytes2023-04-27 23:08:48
965352022212458谭超Compile Error
0KB
0ms
C1693 bytes2023-04-27 16:26:02
965322022212458谭超Runtime Error
1196KB
11ms
C1491 bytes2023-04-27 16:20:29
965102022212458谭超*Accepted65379
1192KB
12ms
C1691 bytes2023-04-27 15:39:26
964722022210177牛梓帆*Accepted64826
1192KB
13ms
C1689 bytes2023-04-27 12:30:38