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 00:47:11
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
964382022210177牛梓帆Wrong Answer
1192KB
10ms
C2688 bytes2023-04-27 11:14:10
964282022210177牛梓帆Wrong Answer
1192KB
11ms
C2687 bytes2023-04-27 10:58:13
964152022210177牛梓帆Wrong Answer
1192KB
11ms
C2688 bytes2023-04-27 10:50:55
957322022212458谭超Wrong Answer
1196KB
60ms
C2500 bytes2023-04-26 10:55:24
957282022212458谭超Wrong Answer
1196KB
71ms
C2497 bytes2023-04-26 10:46:22
957102022212458谭超Wrong Answer
1196KB
71ms
C2494 bytes2023-04-26 10:01:14
957082022212458谭超Compile Error
0KB
0ms
C2495 bytes2023-04-26 09:59:48
957072022212458谭超Compile Error
0KB
0ms
C2498 bytes2023-04-26 09:59:09
957052022212458谭超Compile Error
0KB
0ms
C2481 bytes2023-04-26 09:56:56
957012022212458谭超Compile Error
0KB
0ms
C2485 bytes2023-04-26 09:54:54
90362202221262520222122625Accepted
1072KB
11ms
C1189 bytes2023-04-17 23:13:36
90354202221262520222122625Time Limit Exceed
50256KB
8819ms
C1187 bytes2023-04-17 23:03:05
903522022212922sherryAccepted
1192KB
12ms
C1772 bytes2023-04-17 23:00:55
90338202221262520222122625Time Limit Exceed
50256KB
8821ms
C1188 bytes2023-04-17 22:51:06
90298202221262520222122625Time Limit Exceed
50256KB
8794ms
C1179 bytes2023-04-17 22:13:38
90292202221262520222122625Time Limit Exceed
50256KB
8814ms
C1179 bytes2023-04-17 22:05:50
90203202221262520222122625Accepted
1192KB
12ms
C1336 bytes2023-04-17 19:50:40
90012202221262520222122625Wrong Answer
1192KB
12ms
C1254 bytes2023-04-17 11:21:20
90007202221262520222122625Wrong Answer
1192KB
12ms
C1254 bytes2023-04-17 11:16:37
89992202221262520222122625Wrong Answer
1192KB
8ms
C1253 bytes2023-04-17 11:04:46
89989202221262520222122625Wrong Answer
1192KB
11ms
C1285 bytes2023-04-17 10:59:47
89988202221262520222122625Wrong Answer
1192KB
12ms
C1262 bytes2023-04-17 10:56:55
89986202221262520222122625Wrong Answer
1192KB
11ms
C1192 bytes2023-04-17 10:54:47
89982202221262520222122625Wrong Answer
1192KB
13ms
C1081 bytes2023-04-17 10:36:42
89970202221262520222122625Wrong Answer
1192KB
13ms
C1152 bytes2023-04-17 10:13:11
89969202221262520222122625Wrong Answer
1192KB
11ms
C1090 bytes2023-04-17 10:07:44
898802022212367wxtAccepted
1192KB
11ms
C2265 bytes2023-04-16 22:54:46
898412022212367wxt*Accepted65379
1192KB
10ms
C1834 bytes2023-04-16 22:30:05
898302022212367wxtAccepted
1068KB
11ms
C1166 bytes2023-04-16 22:19:29
89782202221262520222122625Wrong Answer
1192KB
12ms
C1087 bytes2023-04-16 21:34:33
89773202221262520222122625Wrong Answer
1192KB
11ms
C1085 bytes2023-04-16 21:27:41
89770202221262520222122625Runtime Error
1192KB
8ms
C1085 bytes2023-04-16 21:26:44
895712022212857zealotAccepted
1196KB
13ms
C2499 bytes2023-04-16 15:33:54
895602022212857zealotWrong Answer
1196KB
12ms
C2958 bytes2023-04-16 15:14:59
891352022212367wxt*Accepted64826
1192KB
11ms
C1772 bytes2023-04-14 21:18:35
891242022212367wxtAccepted
1192KB
11ms
C1881 bytes2023-04-14 21:09:14
889372022212247马梓洋Wrong Answer
1192KB
12ms
C1692 bytes2023-04-14 17:18:54
889312022212247马梓洋Runtime Error
1068KB
10ms
C1947 bytes2023-04-14 17:09:21
889302022212247马梓洋Compile Error
0KB
0ms
C2048 bytes2023-04-14 17:08:47
889122022212247马梓洋Wrong Answer
1068KB
11ms
C1154 bytes2023-04-14 16:57:15
889072022212247马梓洋Wrong Answer
1068KB
10ms
C1048 bytes2023-04-14 16:54:55
889052022212247马梓洋Wrong Answer
1068KB
11ms
C957 bytes2023-04-14 16:52:42
889002022212247马梓洋Wrong Answer
1068KB
13ms
C974 bytes2023-04-14 16:48:55
888722022212744aggylowAccepted
1196KB
12ms
C1887 bytes2023-04-14 16:05:05
888592022212744aggylowWrong Answer
1196KB
10ms
C1868 bytes2023-04-14 15:50:36
888542022212744aggylowWrong Answer
1196KB
12ms
C1867 bytes2023-04-14 15:37:40
887842022212857zealotAccepted
1068KB
13ms
C1546 bytes2023-04-14 10:33:00
887832022212857zealotOutput Limit Exceed
1068KB
12ms
C1824 bytes2023-04-14 10:28:54
887812022212857zealotAccepted
1192KB
12ms
C2321 bytes2023-04-14 10:25:50
887772022212857zealotCompile Error
0KB
0ms
C1840 bytes2023-04-14 10:15:01