CONTEST ID : 1128 - 2023春-计导课设-9-12班-文件练习

文件操作练习。注意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-19 20:23:40
Finished

STATUS : End    OPEN : Private
Start Time : 2023-03-20 20: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
904092022211348范特西Wrong Answer
1196KB
10ms
C1922 bytes2023-04-18 00:56:24
904082022211348范特西Wrong Answer
1196KB
11ms
C1922 bytes2023-04-18 00:55:59
904072022211348范特西Wrong Answer
1196KB
8ms
C1903 bytes2023-04-18 00:54:23
904062022211348范特西Wrong Answer
1196KB
10ms
C1920 bytes2023-04-18 00:53:09
904022022211348范特西Wrong Answer
1196KB
11ms
C1920 bytes2023-04-18 00:44:46
808892022211348范特西Accepted
1072KB
11ms
C1211 bytes2023-04-03 22:04:08
808792022211348范特西Wrong Answer
1072KB
11ms
C1363 bytes2023-04-03 22:01:30
808762022211348范特西Wrong Answer
1072KB
13ms
C1374 bytes2023-04-03 22:00:36
808732022211348范特西Accepted
1072KB
12ms
C1207 bytes2023-04-03 21:59:14
808682022211348范特西Output Limit Exceed
1072KB
12ms
C1163 bytes2023-04-03 21:58:00
808612022211348范特西Output Limit Exceed
1072KB
11ms
C1326 bytes2023-04-03 21:56:07
808602022211348范特西Output Limit Exceed
1072KB
14ms
C1308 bytes2023-04-03 21:55:31
808502022211348范特西Accepted
1072KB
11ms
C1207 bytes2023-04-03 21:51:15
808352022211348范特西Wrong Answer
1072KB
11ms
C1393 bytes2023-04-03 21:47:58
808192022211348范特西Wrong Answer
1072KB
12ms
C1374 bytes2023-04-03 21:36:01
808002022211348范特西Accepted
1072KB
12ms
C1565 bytes2023-04-03 21:28:13
807962022211348范特西Wrong Answer
1072KB
9ms
C1553 bytes2023-04-03 21:27:19
807892022211348范特西Accepted
1072KB
13ms
C1567 bytes2023-04-03 21:23:44
807862022211348范特西Time Limit Exceed
1072KB
8805ms
C1451 bytes2023-04-03 21:22:15
807792022211348范特西Time Limit Exceed
1072KB
8813ms
C1362 bytes2023-04-03 21:19:57
807652022211348范特西Accepted
1072KB
15ms
C1658 bytes2023-04-03 21:13:45
807632022211348范特西Wrong Answer
1072KB
10ms
C1645 bytes2023-04-03 21:12:12
807532022211348范特西Wrong Answer
1072KB
13ms
C1630 bytes2023-04-03 21:09:26
807492022211348范特西Wrong Answer
1072KB
9ms
C1535 bytes2023-04-03 21:07:28
807402022211348范特西Time Limit Exceed
1072KB
3530ms
C1330 bytes2023-04-03 21:01:07
806852022211348范特西Time Limit Exceed
1072KB
3526ms
C1366 bytes2023-04-03 20:32:05
785822022211348范特西Wrong Answer
1192KB
9ms
C1964 bytes2023-04-02 13:51:34
785802022211348范特西Compile Error
0KB
0ms
C1967 bytes2023-04-02 13:50:41
785692022211348范特西Wrong Answer
1192KB
10ms
C1827 bytes2023-04-02 13:29:15
785682022211348范特西Wrong Answer
1192KB
10ms
C1829 bytes2023-04-02 13:28:44
785662022211348范特西*Accepted65025
1192KB
12ms
C1848 bytes2023-04-02 13:27:55
785652022211348范特西Compile Error
0KB
0ms
C1845 bytes2023-04-02 13:26:53
785632022211348范特西Output Limit Exceed
1192KB
12ms
C1940 bytes2023-04-02 13:25:58
785542022211348范特西Output Limit Exceed
1192KB
3533ms
C1919 bytes2023-04-02 13:21:35
785522022211348范特西Compile Error
0KB
0ms
C1835 bytes2023-04-02 13:19:54
785432022211348范特西Output Limit Exceed
1192KB
3527ms
C1931 bytes2023-04-02 13:11:48
785272022211348范特西Output Limit Exceed
1192KB
3523ms
C1919 bytes2023-04-02 12:56:57
756372022211348范特西Wrong Answer
1196KB
11ms
C1922 bytes2023-03-30 23:50:33
756322022211348范特西Wrong Answer
1196KB
10ms
C1920 bytes2023-03-30 23:49:29
755592022211348范特西*Accepted64826
1192KB
9ms
C1983 bytes2023-03-30 23:18:35
755542022211348范特西Wrong Answer
1196KB
11ms
C1919 bytes2023-03-30 23:17:00
755482022211348范特西Compile Error
0KB
0ms
C1918 bytes2023-03-30 23:15:35
755352022211348范特西Compile Error
0KB
0ms
C1933 bytes2023-03-30 23:10:52
755302022211348范特西Compile Error
0KB
0ms
C2019 bytes2023-03-30 23:08:14
729492022211348范特西Accepted
1200KB
11ms
C2873 bytes2023-03-29 17:27:39
729442022211348范特西Accepted
1200KB
10ms
C2822 bytes2023-03-29 17:25:22
729322022211348范特西Accepted
1200KB
10ms
C2875 bytes2023-03-29 17:15:53
729302022211348范特西Wrong Answer
1200KB
10ms
C2865 bytes2023-03-29 17:14:31
729132022211348范特西Wrong Answer
1200KB
11ms
C2811 bytes2023-03-29 17:03:05
729122022211348范特西Compile Error
0KB
0ms
C2802 bytes2023-03-29 17:02:23