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 07:27:46
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
702412021211233李志博Wrong Answer
1196KB
10ms
C1925 bytes2023-03-27 10:42:36
702382021211233李志博Wrong Answer
1196KB
13ms
C1906 bytes2023-03-27 10:41:45
702322021211233李志博Wrong Answer
1196KB
10ms
C1900 bytes2023-03-27 10:34:32
702312021211233李志博Wrong Answer
1196KB
12ms
C1881 bytes2023-03-27 10:33:51
702142021211233李志博Wrong Answer
1196KB
12ms
C1870 bytes2023-03-27 10:13:14
702122021211233李志博Wrong Answer
1196KB
11ms
C1538 bytes2023-03-27 09:55:55
701732021211233李志博Output Limit Exceed
1192KB
12ms
C1714 bytes2023-03-27 04:07:55
701232022212497xx*Accepted65379
1192KB
9ms
C1503 bytes2023-03-27 00:47:03
701192022212497xxAccepted
1072KB
13ms
C1177 bytes2023-03-27 00:44:01
700792022212615luckyBUPTWrong Answer
1068KB
20ms
C2018 bytes2023-03-27 00:02:47
700762022212615luckyBUPTWrong Answer
1068KB
11ms
C1706 bytes2023-03-27 00:00:12
700712022212615luckyBUPTOutput Limit Exceed
1068KB
2524ms
C2379 bytes2023-03-26 23:55:38
699792022210792『 』Accepted
1192KB
11ms
C1643 bytes2023-03-26 22:04:43
699612022210792『 』Wrong Answer
1192KB
12ms
C1701 bytes2023-03-26 21:55:39
699472022210792『 』Wrong Answer
1192KB
12ms
C1715 bytes2023-03-26 21:48:48
699442022210792『 』Wrong Answer
1192KB
9ms
C1686 bytes2023-03-26 21:47:42
699302021211233李志博Wrong Answer
1240KB
10ms
C1555 bytes2023-03-26 21:41:18
697372021211233李志博*Accepted53456
1192KB
12ms
C1516 bytes2023-03-26 18:13:54
697182021211233李志博Wrong Answer
1196KB
13ms
C1493 bytes2023-03-26 18:05:04
697152021211233李志博Wrong Answer
1196KB
12ms
C1481 bytes2023-03-26 18:04:40
697092021211233李志博Wrong Answer
1196KB
12ms
C1480 bytes2023-03-26 18:02:12
697062021211233李志博Wrong Answer
1196KB
7ms
C1480 bytes2023-03-26 18:00:39
696922021211233李志博Wrong Answer
1196KB
11ms
C1475 bytes2023-03-26 17:52:28
696852021211233李志博Wrong Answer
1196KB
11ms
C1476 bytes2023-03-26 17:49:35
696842021211233李志博Wrong Answer
1196KB
9ms
C1476 bytes2023-03-26 17:49:12
696822021211233李志博Wrong Answer
1196KB
12ms
C1476 bytes2023-03-26 17:48:50
696802021211233李志博Wrong Answer
1196KB
10ms
C1476 bytes2023-03-26 17:47:37
696632021211233李志博Wrong Answer
1196KB
12ms
C1403 bytes2023-03-26 17:41:30
696552021211233李志博Wrong Answer
1196KB
11ms
C1387 bytes2023-03-26 17:37:00
696222021211233李志博Wrong Answer
1196KB
12ms
C1794 bytes2023-03-26 17:13:38
696142021211233李志博Wrong Answer
1196KB
12ms
C1766 bytes2023-03-26 17:08:51
696002021211233李志博Runtime Error
1196KB
10ms
C1767 bytes2023-03-26 16:59:31
695982021211233李志博Wrong Answer
1196KB
11ms
C1769 bytes2023-03-26 16:59:05
695812021211233李志博Wrong Answer
1196KB
10ms
C1769 bytes2023-03-26 16:51:19
695472021211233李志博Wrong Answer
1196KB
12ms
C1794 bytes2023-03-26 16:30:44
694572021211233李志博Wrong Answer
1196KB
11ms
C1715 bytes2023-03-26 15:35:53
694302021211233李志博Wrong Answer
1196KB
10ms
C1487 bytes2023-03-26 15:16:50
694262022211698李佳伊Accepted
1192KB
12ms
C1364 bytes2023-03-26 15:14:04
694192022211698李佳伊Runtime Error
1196KB
10ms
C1332 bytes2023-03-26 15:08:40
694142021211233李志博Wrong Answer
1196KB
10ms
C1391 bytes2023-03-26 15:05:15
694032022211698李佳伊*Accepted64954
1192KB
11ms
C2048 bytes2023-03-26 14:54:07
693922022211698李佳伊Runtime Error
1196KB
13ms
C1334 bytes2023-03-26 14:50:34
693702021211233李志博Wrong Answer
1196KB
11ms
C1391 bytes2023-03-26 14:36:44
693632021211233李志博Wrong Answer
1196KB
9ms
C1165 bytes2023-03-26 14:29:12
693552021211233李志博Runtime Error
1196KB
7ms
C1166 bytes2023-03-26 14:22:29
693542022211698李佳伊Accepted
1192KB
11ms
C1405 bytes2023-03-26 14:22:15
693452022211698李佳伊Wrong Answer
1192KB
9ms
C1404 bytes2023-03-26 14:19:44
693082022211698李佳伊Time Limit Exceed
1192KB
3526ms
C1393 bytes2023-03-26 13:49:41
693052022211698李佳伊Time Limit Exceed
1192KB
3516ms
C1395 bytes2023-03-26 13:48:17
692992022211698李佳伊Time Limit Exceed
1192KB
3525ms
C1362 bytes2023-03-26 13:41:18