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 06:30:48
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
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
808402022213782indicationRuntime Error
1192KB
6ms
C1399 bytes2023-04-03 21:49:01
808252022210470周宇洋*Accepted64994
1068KB
11ms
C2060 bytes2023-04-03 21:40:12
808242022210470周宇洋*Accepted65047
1196KB
11ms
C2935 bytes2023-04-03 21:38:57
808222022210470周宇洋*Accepted64826
1192KB
14ms
C2204 bytes2023-04-03 21:37:59
808162022210470周宇洋*Accepted64996
1192KB
17ms
C4101 bytes2023-04-03 21:35:24
807592022210484空条承太郎Wrong Answer
1068KB
10ms
C1360 bytes2023-04-03 21:10:56
806772022210484空条承太郎Wrong Answer
1068KB
10ms
C1366 bytes2023-04-03 20:26:27
8059520222124992022212499Accepted
1192KB
13ms
C1252 bytes2023-04-03 19:36:25
8016920222124992022212499Wrong Answer
1192KB
6ms
C1280 bytes2023-04-03 14:44:55
8016720222124992022212499Wrong Answer
1192KB
6ms
C1254 bytes2023-04-03 14:43:33
801652022210484空条承太郎Wrong Answer
1068KB
13ms
C1325 bytes2023-04-03 14:36:06
801642022210484空条承太郎Wrong Answer
1068KB
10ms
C1325 bytes2023-04-03 14:32:10
801622022210484空条承太郎Wrong Answer
1068KB
12ms
C1315 bytes2023-04-03 14:15:25
801612022210484空条承太郎Runtime Error
1068KB
10ms
C1384 bytes2023-04-03 14:15:11
801592022210484空条承太郎Compile Error
0KB
0ms
C1366 bytes2023-04-03 14:12:22
801572022210484空条承太郎Compile Error
0KB
0ms
C1315 bytes2023-04-03 14:10:32
801382022210583cc*Accepted65379
1192KB
11ms
C1810 bytes2023-04-03 12:31:34
801372022210583ccWrong Answer
1192KB
12ms
C1741 bytes2023-04-03 12:30:28
801362022210583ccWrong Answer
1192KB
9ms
C1810 bytes2023-04-03 12:29:57
801352022210583cc*Accepted64954
1192KB
11ms
C1788 bytes2023-04-03 12:16:43
801342022210583cc*Accepted64954
1192KB
13ms
C1668 bytes2023-04-03 12:09:10
801312022210583ccAccepted
1192KB
10ms
C1904 bytes2023-04-03 11:26:30
801282022210583ccWrong Answer
1192KB
10ms
C1835 bytes2023-04-03 11:20:45
794482022212139zzzAccepted
1068KB
12ms
C1243 bytes2023-04-03 00:23:34
7944620222124992022212499Wrong Answer
1192KB
6ms
C1245 bytes2023-04-03 00:14:59
7944420222120362022212036Accepted
1196KB
13ms
C2044 bytes2023-04-03 00:02:11
7944320222120362022212036Compile Error
0KB
0ms
C2043 bytes2023-04-03 00:01:41
7944220222124992022212499Wrong Answer
1192KB
6ms
C1266 bytes2023-04-02 23:57:14
7943920222124992022212499Wrong Answer
1192KB
4ms
C1265 bytes2023-04-02 23:49:59
7941920222120362022212036*Accepted64826
1192KB
11ms
C1723 bytes2023-04-02 23:10:29
7941320222120362022212036Wrong Answer
1192KB
11ms
C1649 bytes2023-04-02 23:05:29
7934920222120362022212036Accepted
1224KB
9ms
C4921 bytes2023-04-02 21:21:26
791892022210484空条承太郎Output Limit Exceed
1068KB
11ms
C1343 bytes2023-04-02 20:08:34
791882022210484空条承太郎Runtime Error
1068KB
10ms
C1412 bytes2023-04-02 20:08:22
7916320222120362022212036Wrong Answer
1224KB
9ms
C4400 bytes2023-04-02 20:02:40
791262022210484空条承太郎Output Limit Exceed
1068KB
10ms
C1341 bytes2023-04-02 19:52:51
791162022210484空条承太郎Compile Error
0KB
0ms
C1349 bytes2023-04-02 19:48:26
789832022210484空条承太郎Output Limit Exceed
1068KB
14ms
C1341 bytes2023-04-02 18:57:23
789442022211668字禹润Accepted
1192KB
11ms
C3315 bytes2023-04-02 18:38:34
788562022210484空条承太郎Output Limit Exceed
1068KB
11ms
C1333 bytes2023-04-02 17:25:24
788472022210484空条承太郎Output Limit Exceed
1068KB
10ms
C1333 bytes2023-04-02 17:18:44
788432022210484空条承太郎Compile Error
0KB
0ms
C1346 bytes2023-04-02 17:16:57
787922022212139zzzAccepted
1192KB
11ms
C1851 bytes2023-04-02 16:40:00
787062022210484空条承太郎Accepted
1192KB
10ms
C1627 bytes2023-04-02 15:42:27