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-22 01:01:17
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
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
747962022210130世间万物Wrong Answer
1192KB
10ms
C1480 bytes2023-03-30 18:44:01
746632022210484空条承太郎Accepted
1192KB
12ms
C1815 bytes2023-03-30 17:30:38
746562022210484空条承太郎Wrong Answer
1192KB
12ms
C1860 bytes2023-03-30 17:27:32
746452022210484空条承太郎Wrong Answer
1192KB
11ms
C1794 bytes2023-03-30 17:22:47
746162022210484空条承太郎Wrong Answer
1192KB
13ms
C1767 bytes2023-03-30 17:08:30
746152022210484空条承太郎Runtime Error
1192KB
6ms
C1767 bytes2023-03-30 17:08:06
745902022210484空条承太郎Wrong Answer
1192KB
12ms
C1734 bytes2023-03-30 16:54:29
745862022210484空条承太郎Wrong Answer
1192KB
12ms
C1739 bytes2023-03-30 16:51:09
745852022210484空条承太郎Runtime Error
1192KB
5ms
C1770 bytes2023-03-30 16:50:37
745672022210484空条承太郎Wrong Answer
1192KB
11ms
C1945 bytes2023-03-30 16:42:05
745662022210484空条承太郎Runtime Error
1192KB
5ms
C1945 bytes2023-03-30 16:41:11
745572022210484空条承太郎Compile Error
0KB
0ms
C1909 bytes2023-03-30 16:36:38
744272022210130世间万物Accepted
1192KB
11ms
C1551 bytes2023-03-30 15:33:34
744152022210130世间万物Wrong Answer
1192KB
12ms
C1633 bytes2023-03-30 15:26:18
744112022210130世间万物Runtime Error
1192KB
10ms
C1636 bytes2023-03-30 15:23:57
744052022210130世间万物Runtime Error
1192KB
9ms
C1636 bytes2023-03-30 15:20:35
743812022210130世间万物Accepted
1192KB
12ms
C1397 bytes2023-03-30 14:59:36
743782022210130世间万物Wrong Answer
1192KB
12ms
C1339 bytes2023-03-30 14:58:01
743772022210130世间万物Runtime Error
1192KB
7ms
C1336 bytes2023-03-30 14:56:53
743752022210130世间万物Runtime Error
1192KB
7ms
C1339 bytes2023-03-30 14:56:10
742372022210145Jeff*Accepted65047
1196KB
12ms
C2534 bytes2023-03-30 11:57:40
742352022210145JeffWrong Answer
1196KB
10ms
C2602 bytes2023-03-30 11:53:30
742182022210145JeffWrong Answer
1196KB
9ms
C2650 bytes2023-03-30 11:38:07
742162022210145JeffWrong Answer
1196KB
12ms
C2650 bytes2023-03-30 11:36:43
7365420222120362022212036Accepted
1196KB
12ms
C2134 bytes2023-03-29 22:19:40
7363920222120362022212036Accepted
1196KB
10ms
C2288 bytes2023-03-29 22:13:17
735642022210145JeffWrong Answer
1192KB
13ms
C2017 bytes2023-03-29 21:49:06
735602022212615luckyBUPTOutput Limit Exceed
1192KB
9ms
C927 bytes2023-03-29 21:48:26