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 23:19:40
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
778222022212139zzzRuntime Error
1192KB
8ms
C2191 bytes2023-04-01 14:35:40
778082022212511蔡逸文Wrong Answer
1192KB
10ms
C1525 bytes2023-04-01 13:51:27
778022022212511蔡逸文Wrong Answer
1192KB
11ms
C1521 bytes2023-04-01 13:47:26
777932022212511蔡逸文Wrong Answer
1192KB
12ms
C1505 bytes2023-04-01 13:30:04
777912022212511蔡逸文Wrong Answer
1192KB
7ms
C1505 bytes2023-04-01 13:28:37
766242022212139zzzAccepted
1200KB
13ms
C3051 bytes2023-03-31 19:05:04
766152022212139zzzWrong Answer
1200KB
12ms
C3053 bytes2023-03-31 18:50:36
766022022212139zzzWrong Answer
1200KB
12ms
C3056 bytes2023-03-31 18:37:56
765382022212139zzzWrong Answer
1200KB
12ms
C3080 bytes2023-03-31 17:39:37
764102022212744aggylowWrong Answer
1192KB
10ms
C1361 bytes2023-03-31 16:05:44
763982022212744aggylowWrong Answer
1192KB
10ms
C1370 bytes2023-03-31 16:00:37
763922022212744aggylowWrong Answer
1192KB
12ms
C1368 bytes2023-03-31 15:54:57
763882022212744aggylowWrong Answer
1192KB
13ms
C1368 bytes2023-03-31 15:53:23
763762022211656包诗峰Accepted
1192KB
11ms
C1989 bytes2023-03-31 15:43:38
763622022211656包诗峰Accepted
1196KB
10ms
C1933 bytes2023-03-31 15:26:52
763462022212744aggylowRuntime Error
1192KB
6ms
C1352 bytes2023-03-31 15:15:17
7633620222120362022212036Accepted
1116KB
12ms
C1162 bytes2023-03-31 15:08:16
763212022211656包诗峰Wrong Answer
1196KB
12ms
C1799 bytes2023-03-31 14:58:45
760252022210130世间万物Accepted
1192KB
12ms
C1500 bytes2023-03-31 11:02:01
760092022210130世间万物Accepted
1088KB
10ms
C1086 bytes2023-03-31 10:56:28
759982022210130世间万物Wrong Answer
1088KB
11ms
C1086 bytes2023-03-31 10:53:46
759872022210130世间万物Presentation Error
1192KB
11ms
C1500 bytes2023-03-31 10:46:57
7580920222120362022212036Wrong Answer
1116KB
10ms
C1136 bytes2023-03-31 07:36:05
756622022212744aggylowRuntime Error
1192KB
6ms
C1352 bytes2023-03-31 00:00:42
754272022210130世间万物Wrong Answer
1088KB
10ms
C1107 bytes2023-03-30 22:36:02
7540620222120362022212036Wrong Answer
1220KB
9ms
C1115 bytes2023-03-30 22:28:31
754052022210130世间万物Wrong Answer
1088KB
9ms
C1105 bytes2023-03-30 22:28:23
754032022210130世间万物Runtime Error
1088KB
9ms
C1105 bytes2023-03-30 22:28:09
7538720222120362022212036Wrong Answer
1204KB
12ms
C1116 bytes2023-03-30 22:24:04
753522022211656包诗峰Wrong Answer
1196KB
11ms
C1799 bytes2023-03-30 22:15:15
753492022211656包诗峰Wrong Answer
1196KB
13ms
C1795 bytes2023-03-30 22:14:23
753082022210130世间万物Wrong Answer
1088KB
10ms
C1002 bytes2023-03-30 22:05:36
752992022210792『 』Accepted
1068KB
12ms
C885 bytes2023-03-30 22:04:15
7527120222120362022212036Wrong Answer
1204KB
9ms
C1115 bytes2023-03-30 21:54:53
7526020222120362022212036Wrong Answer
1204KB
12ms
C1118 bytes2023-03-30 21:53:19
752512022210130世间万物Wrong Answer
1088KB
13ms
C1002 bytes2023-03-30 21:50:30
7521420222120362022212036Wrong Answer
1204KB
10ms
C1125 bytes2023-03-30 21:40:22
751182022210130世间万物Runtime Error
1216KB
10ms
C955 bytes2023-03-30 21:11:05
751142022210130世间万物Runtime Error
1212KB
9ms
C955 bytes2023-03-30 21:10:25
751102022210792『 』Accepted
1192KB
14ms
C1166 bytes2023-03-30 21:09:57
7509820222120362022212036Wrong Answer
1088KB
10ms
C1238 bytes2023-03-30 21:08:00
750902022210792『 』Wrong Answer
1192KB
11ms
C1151 bytes2023-03-30 21:07:06
750732022210792『 』Output Limit Exceed
1192KB
7043ms
C1089 bytes2023-03-30 21:03:20
750062022212615luckyBUPTAccepted
1068KB
12ms
C779 bytes2023-03-30 20:48:07
749442022210792『 』*Accepted53456
1192KB
12ms
C1606 bytes2023-03-30 20:33:47
749102022210792『 』Wrong Answer
1192KB
12ms
C1421 bytes2023-03-30 20:03:53
748862022210792『 』Wrong Answer
1192KB
13ms
C1873 bytes2023-03-30 19:50:49
748752022210792『 』Runtime Error
1192KB
10ms
C1873 bytes2023-03-30 19:45:51
748342022212615luckyBUPTAccepted
2100KB
10ms
C857 bytes2023-03-30 19:15:36
748042022210130世间万物Wrong Answer
1192KB
10ms
C1499 bytes2023-03-30 18:50:41