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 02:10:26
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
838692022210466阿三太帅呀*Accepted64825
1200KB
12ms
C3446 bytes2023-04-06 15:23:47
832082022210145JeffWrong Answer
1068KB
11ms
C1594 bytes2023-04-05 20:40:23
831542022210145JeffRuntime Error
1068KB
8ms
C1107 bytes2023-04-05 20:05:05
830312022213782indicationAccepted
1192KB
10ms
C1380 bytes2023-04-05 18:05:22
830262022212111码码哈哈Wrong Answer
1196KB
11ms
C1600 bytes2023-04-05 17:55:55
830252022213782indicationWrong Answer
1192KB
10ms
C1387 bytes2023-04-05 17:54:58
830152022212111码码哈哈Runtime Error
1196KB
7ms
C1535 bytes2023-04-05 17:43:50
830132022212111码码哈哈Compile Error
0KB
0ms
C1540 bytes2023-04-05 17:42:09
830082022213782indicationWrong Answer
1192KB
11ms
C1433 bytes2023-04-05 17:40:26
830072022212111码码哈哈Compile Error
0KB
0ms
C1536 bytes2023-04-05 17:40:19
829682022213782indicationAccepted
1068KB
10ms
C1262 bytes2023-04-05 17:11:47
829102022213782indicationAccepted
1068KB
12ms
C1195 bytes2023-04-05 16:53:36
828162022212111码码哈哈Wrong Answer
1192KB
11ms
C2181 bytes2023-04-05 16:08:44
828142022210576idle*Accepted64826
1192KB
12ms
C1621 bytes2023-04-05 16:08:12
828112022212111码码哈哈Wrong Answer
1192KB
12ms
C2181 bytes2023-04-05 16:07:55
828092022212111码码哈哈Wrong Answer
1192KB
11ms
C2177 bytes2023-04-05 16:05:45
827942022210576idleWrong Answer
1192KB
10ms
C1622 bytes2023-04-05 16:01:06
827882022212111码码哈哈Wrong Answer
1192KB
9ms
C2193 bytes2023-04-05 15:58:16
827872022210576idleWrong Answer
1192KB
10ms
C1620 bytes2023-04-05 15:58:10
827802022210576idleWrong Answer
1192KB
11ms
C1631 bytes2023-04-05 15:56:24
827792022212111码码哈哈Wrong Answer
1192KB
12ms
C2136 bytes2023-04-05 15:55:27
827772022210576idleWrong Answer
1192KB
10ms
C1632 bytes2023-04-05 15:54:25
827572022210576idleWrong Answer
1196KB
9ms
C1696 bytes2023-04-05 15:47:54
827552022212111码码哈哈Wrong Answer
1192KB
10ms
C2136 bytes2023-04-05 15:47:07
827532022210576idleCompile Error
0KB
0ms
C1725 bytes2023-04-05 15:46:36
827512022210576idleCompile Error
0KB
0ms
C1711 bytes2023-04-05 15:45:45
820622022210583ccAccepted
1192KB
11ms
C1399 bytes2023-04-04 23:19:58
817572022211668字禹润Accepted
1068KB
14ms
C1887 bytes2023-04-04 21:05:17
815842022210583ccRuntime Error
1192KB
10ms
C1503 bytes2023-04-04 19:23:14
812962022210484空条承太郎Accepted
1192KB
11ms
C5065 bytes2023-04-04 15:41:17
812932022210484空条承太郎Wrong Answer
1192KB
12ms
C4759 bytes2023-04-04 15:31:53
812922022210484空条承太郎Compile Error
0KB
0ms
C4738 bytes2023-04-04 15:31:20
811842022210583ccWrong Answer
1192KB
9ms
C1438 bytes2023-04-04 12:09:36
810892022210484空条承太郎Wrong Answer
1192KB
12ms
C4755 bytes2023-04-04 00:19:12
809812022210583ccCompile Error
0KB
0ms
C1263 bytes2023-04-03 23:01:21
809642022210583ccCompile Error
0KB
0ms
C1208 bytes2023-04-03 22:48:51
809462022210583ccCompile Error
0KB
0ms
C1207 bytes2023-04-03 22:40:55
809432022210583ccCompile Error
0KB
0ms
C1189 bytes2023-04-03 22:39:33
808962022213782indicationAccepted
1192KB
10ms
C1474 bytes2023-04-03 22:06:00
808922022213782indicationWrong Answer
1192KB
9ms
C1473 bytes2023-04-03 22:04:56
808902022213782indicationWrong Answer
1192KB
12ms
C1475 bytes2023-04-03 22:04:37
808852022213782indicationWrong Answer
1192KB
11ms
C1472 bytes2023-04-03 22:03:09
808842022210484空条承太郎Accepted
1068KB
11ms
C1382 bytes2023-04-03 22:02:53
808822022213782indicationWrong Answer
1192KB
9ms
C1473 bytes2023-04-03 22:02:13
808802022213782indicationWrong Answer
1192KB
8ms
C1475 bytes2023-04-03 22:01:42
808722022213782indicationWrong Answer
1192KB
10ms
C1473 bytes2023-04-03 21:59:11
808662022213782indicationWrong Answer
1192KB
10ms
C1468 bytes2023-04-03 21:57:43
808642022213782indicationWrong Answer
1192KB
12ms
C1466 bytes2023-04-03 21:57:03
808552022213782indicationWrong Answer
1192KB
8ms
C1414 bytes2023-04-03 21:53:30
808472022213782indicationWrong Answer
1192KB
13ms
C1416 bytes2023-04-03 21:50:35