例题4-6 师兄帮帮忙 UVa12412

《算法竞赛入门经典第2版》题解目录索引 《算法竞赛入门经典第2版》题解目录索引 本文包含紫书的例题和习题分析题解的目录索引和一些建议 紫书刷题进行中,github题解系列点这里 OJ网址点这里 第三章 本章难度不高,可练习基本技巧,如输入输出格式,字符串处理,打表,STL使用,双指针,周期模型处理(循环节),对数降维等知识点,高手可跳过 书中编号 题目编号 标题(题解链接) 分类 备注 例题3-1 UVA272 Tex... 阅读详情

例题4-6 师兄帮帮忙 UVa12412

感悟。

1、阅读书中题目,从网站下载英文原题,重点在看输出数据与格式。

2、开始编码,先搭函数框架,具体功能实现,待主体框架打好后,再进行。

3、程序测试比较繁琐,有较多的输出输出,有些接近现实的应用程序了。

4、add功能还算顺利,数据采用结构体数组的方式存储。

5、query功能,发现要添加要在结构体中继续添加一些数据,还需在add功能中添加相应数据的处理功能。

6、statistics功能,发现还要添加新的结构体,要在add功能中添加相应数据处理功能,真受不了啊。

7、学了一招,结构体初始化clwhole=(struct classinfo){0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};

8、一个功能一个功能的写,多次用到printf进行跟踪,有些错误,不靠跟踪是无法检查出的。

9、10.21下午,总算写好,能对上基本的输入输出,提交WA,估计要格式完全对上,开始对照格式进行修改。

10、改格式之前,重读英文原题,发现漏了Hint部分,马上照做,提交WA。

11、对照输入输出格式,详细修改一遍,提交WA。

12、暂时没辙,先放一放,看看中文书,有没什么没注意到的地方。

13、中文书阅读后,无论是分析还是解法,都与本人比较相似,暂无启发。

14、测试了一遍同名统计,发现统计中漏了提示语,补上,测时同名次通过,提交WA。

15、重新阅读英文文档,对照着功能进行测试,发现一处遗漏,
//print out all the matching students, in the same order they’re added to the database.
本人是按总分自大到小输出的,原文要求按添加顺序进行输出,
着手进行修改,在结构体中添加了int add;进行添加顺序记录,
修改相关处理int add的代码,
经输入输出验证通过,提交WA。
开始在网上搜索前人的经验了。
16、阅读博客http://blog.csdn.net/archya/article/details/38345101当数据库被清空后统计函数会出现除0的错误。对remove进行测试,发现删除同名时,只删除一次,马上进行修改。将数据库清空,确实出现除0错误。继续进行修改。提交WA。

17、得使试试对拍了。与AC程序对照输出,找到问题,处理int add出错,修改,继续对拍,完全对上,提交AC,时间2016.10.23 9:41,逆向工程做得不错,找到了解决问题的终极办法,但是,缺点是测试数据比较费劲。

 

附上AC程序,编译环境Dev C++4.9.9.2

388行

#include <stdio.h>
#include <string.h>

struct student{
    int add;//加入顺序,多次WA,重读文档后,添加的新数据。
    int rank;
    char sid[30];
    int cid;
    char name[20];
    int chinese;
    int math;
    int english;
    int programming;
    int sum;
    float avr;
}stu[110],tmpstu;

struct classinfo{
    float chinese_avr;
    int chinese_p;
    int chinese_f;
    float math_avr;
    int math_p;
    int math_f;
    float english_avr;
    int english_p;
    int english_f;
    float programming_avr;
    int programming_p;
    int programming_f;
    int passed_all;
    int passed_3;
    int passed_2;
    int passed_1;
    int passed_0;
    int num;
}clinfo[110],clwhole;

int count=0;

//测试数据用,专门编写了print函数,用于调试。
void printstu(){
    int i;
    printf("stu %d\n",count);
    for(i=0;i<count;i++){
        printf("%d %d %s %d %s %d %d %d %d %d %.2f\n",stu[i].add,stu[i].rank,stu[i].sid,stu[i].cid,stu[i].name,stu[i].chinese,stu[i].math,stu[i].english,stu[i].programming,stu[i].sum,stu[i].avr);
    }
}

void print(){
    int i;
    printf("stu %d\n",count);
    for(i=0;i<count;i++){
        printf("%d %d %s %d %s %d %d %d %d %d %.2f\n",stu[i].add,stu[i].rank,stu[i].sid,stu[i].cid,stu[i].name,stu[i].chinese,stu[i].math,stu[i].english,stu[i].programming,stu[i].sum,stu[i].avr);
    }
    printf("clinfo print\n");
    for(i=0;i<110;i++){
        if(clinfo[i].num>0){
            printf("%.2f %d %d %.2f %d %d %.2f %d %d %.2f %d %d %d %d %d %d %d %d\n",clinfo[i].chinese_avr,clinfo[i].chinese_p,clinfo[i].chinese_f,clinfo[i].math_avr,clinfo[i].math_p,clinfo[i].math_f,clinfo[i].english_avr,clinfo[i].english_p,clinfo[i].english_f,clinfo[i].programming_avr,clinfo[i].programming_p,clinfo[i].programming_f,clinfo[i].passed_all,clinfo[i].passed_3,clinfo[i].passed_2,clinfo[i].passed_1,clinfo[i].passed_0,clinfo[i].num);
        }
    }
    printf("clwhole print\n");
    printf("%.2f %d %d %.2f %d %d %.2f %d %d %.2f %d %d %d %d %d %d %d %d\n",clwhole.chinese_avr,clwhole.chinese_p,clwhole.chinese_f,clwhole.math_avr,clwhole.math_p,clwhole.math_f,clwhole.english_avr,clwhole.english_p,clwhole.english_f,clwhole.programming_avr,clwhole.programming_p,clwhole.programming_f,clwhole.passed_all,clwhole.passed_3,clwhole.passed_2,clwhole.passed_1,clwhole.passed_0,clwhole.num);
}

void processing(){
    int i,j;
    //排序处理,冒泡排序,简单 ,总分自大到小
    for(i=0;i<count;i++){
        for(j=i+1;j<count;j++){
            if(stu[i].sum<stu[j].sum){
                tmpstu=stu[i];
                stu[i]=stu[j];
                stu[j]=tmpstu;
            }
        }
    }
    //编制rank
    for(i=0;i<count;i++){
        stu[i].rank=i+1;//正常排名
        if(i>=1){//排名相同处理
            if(stu[i].sum==stu[i-1].sum)
                stu[i].rank=stu[i-1].rank;
        }
    }
   
    //排序处理,冒泡排序,按添加先后进行排序。因打印是按添加顺序,而非分数高低。多次WA后,在此处进行修改
    for(i=0;i<count;i++){
        for(j=i+1;j<count;j++){
            if(stu[i].add>stu[j].add){
                tmpstu=stu[i];
                stu[i]=stu[j];
                stu[j]=tmpstu;
            }
        }
    }
   
   
    //编制statistcs
   
    //初始化
    memset(clinfo,0,sizeof(clinfo));
    clwhole=(struct classinfo){0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
   
    for(i=0;i<count;i++){
        j=stu[i].cid;
        //chinese
        clinfo[j].chinese_avr+=stu[i].chinese;
        if(stu[i].chinese>=60)
            clinfo[j].chinese_p++;
        else
            clinfo[j].chinese_f++;
       
        //math
        clinfo[j].math_avr+=stu[i].math;
        if(stu[i].math>=60)
            clinfo[j].math_p++;
        else
            clinfo[j].math_f++;
       
        //english
        clinfo[j].english_avr+=stu[i].english;
        if(stu[i].english>=60)
            clinfo[j].english_p++;
        else
            clinfo[j].english_f++;
       
        //programming
        clinfo[j].programming_avr+=stu[i].programming;
        if(stu[i].programming>=60)
            clinfo[j].programming_p++;
        else
            clinfo[j].programming_f++;
       
        if(stu[i].chinese>=60&&stu[i].math>=60&&stu[i].english>=60&&stu[i].programming>=60){//全过
            clinfo[j].passed_all++;
        }else if(stu[i].chinese<60&&stu[i].math<60&&stu[i].english<60&&stu[i].programming<60){//全不过
            clinfo[j].passed_0++;
        }else if((stu[i].chinese<60&&stu[i].math>=60&&stu[i].english>=60&&stu[i].programming>=60)||(stu[i].chinese>=60&&stu[i].math<60&&stu[i].english>=60&&stu[i].programming>=60)||(stu[i].chinese>=60&&stu[i].math>=60&&stu[i].english<60&&stu[i].programming>=60)||(stu[i].chinese>=60&&stu[i].math>=60&&stu[i].english>=60&&stu[i].programming<60)){//只有一门没过,过了三门
            clinfo[j].passed_3++;
        }else if((stu[i].chinese>=60&&stu[i].math<60&&stu[i].english<60&&stu[i].programming<60)||(stu[i].chinese<60&&stu[i].math>=60&&stu[i].english<60&&stu[i].programming<60)||(stu[i].chinese<60&&stu[i].math<60&&stu[i].english>=60&&stu[i].programming<60)||(stu[i].chinese<60&&stu[i].math<60&&stu[i].english<60&&stu[i].programming>=60)){//过了一门
            clinfo[j].passed_1++;
        }else{//过了两门
            clinfo[j].passed_2++;
        }
           
        clinfo[j].num++;
    }
    //班级序号不大于学生数,假定,不知是否正确,试试看。
    for(i=1;i<=count;i++){
        if(clinfo[i].num>0){//班级序号从1开始,而不是0,找到重大Bug i改称i+1
           
            //whole
            clwhole.chinese_avr+=clinfo[i].chinese_avr;
            clwhole.math_avr+=clinfo[i].math_avr;
            clwhole.english_avr+=clinfo[i].english_avr;
            clwhole.programming_avr+=clinfo[i].programming_avr;
            clwhole.num+=clinfo[i].num;
           
            clwhole.chinese_p+=clinfo[i].chinese_p;
            clwhole.chinese_f+=clinfo[i].chinese_f;
            clwhole.math_p+=clinfo[i].math_p;
            clwhole.math_f+=clinfo[i].math_f;
            clwhole.english_p+=clinfo[i].english_p;
            clwhole.english_f+=clinfo[i].english_f;
            clwhole.programming_p+=clinfo[i].programming_p;
            clwhole.programming_f+=clinfo[i].programming_f;
           
            //clinfo
            clinfo[i].chinese_avr/=clinfo[i].num;
            clinfo[i].math_avr/=clinfo[i].num;
            clinfo[i].english_avr/=clinfo[i].num;
            clinfo[i].programming_avr/=clinfo[i].num;
           
            //float处理
            clinfo[i].chinese_avr+=1e-5;
            clinfo[i].math_avr+=1e-5;
            clinfo[i].english_avr+=1e-5;
            clinfo[i].programming_avr+=1e-5;
           
//            printf("count=%d cid=%d %d %d %d %d %d\n",count,i,clinfo[i].passed_all,clinfo[i].passed_3,clinfo[i].passed_2,clinfo[i].passed_1,clinfo[i].passed_0);
            clinfo[i].passed_3+=clinfo[i].passed_all;
            clinfo[i].passed_2+=clinfo[i].passed_3;
            clinfo[i].passed_1+=clinfo[i].passed_2;
//            printf("count=%d cid=%d %d %d %d %d %d\n",count,i,clinfo[i].passed_all,clinfo[i].passed_3,clinfo[i].passed_2,clinfo[i].passed_1,clinfo[i].passed_0);
            //whole
            clwhole.passed_all+=clinfo[i].passed_all;
            clwhole.passed_3+=clinfo[i].passed_3;
            clwhole.passed_2+=clinfo[i].passed_2;
            clwhole.passed_1+=clinfo[i].passed_1;
            clwhole.passed_0+=clinfo[i].passed_0;
        }
    }
    //whole
    if(clwhole.num!=0){//除0错误
        clwhole.chinese_avr/=clwhole.num;
        clwhole.math_avr/=clwhole.num;
        clwhole.english_avr/=clwhole.num;
        clwhole.programming_avr/=clwhole.num;
   
        //float处理
        clwhole.chinese_avr+=1e-5;
        clwhole.math_avr+=1e-5;
        clwhole.english_avr+=1e-5;
        clwhole.programming_avr+=1e-5;
    }
   
   
}

void add(){
    int i;
    while(1){
        printf("Please enter the SID, CID, name and four scores. Enter 0 to finish.\n");
        scanf("%s",stu[count].sid);
        //输入为0,跳出循环
        if(strcmp(stu[count].sid,"0")==0){
            //printstu();
            break;
        }
        scanf("%d%s%d%d%d%d",&stu[count].cid,stu[count].name,&stu[count].chinese,&stu[count].math,&stu[count].english,&stu[count].programming);
        //查找 是否有重复
        for(i=0;i<count;i++){
            if(strcmp(stu[i].sid,stu[count].sid)==0)
                break;
        }
        if(i==count){
            stu[i].sum=stu[i].chinese+stu[i].math+stu[i].english+stu[i].programming;
            stu[i].avr=stu[i].sum/4.0;
           
            stu[i].add=i;//添加序列,从0开始。
           
            count++;
        }
        else
            printf("Duplicated SID.\n");
    }
    //数据处理
    processing();
}

void remove(){
    char s[30];
    int del;
    int i;
    int j;
    while(1){
        printf("Please enter SID or name. Enter 0 to finish.\n");
        scanf("%s",s);
        if(strcmp(s,"0")==0){
            //printstu();
            break;
        }
        del=0;
        if(s[0]>='A'&&s[0]<='Z'){//姓名
            for(i=0;i<count;i++){
                if(strcmp(stu[i].name,s)==0){
                    del++;
                   
                    //自i+1开始,添加序列均自减1
                    for(j=i+1;j<count;j++){
                        stu[j].add--;
                    }
                    
                    stu[i]=stu[count-1];
                    count--;
                    i--;
                    //printstu();
                    processing();//此句开始成功2016.10.23 9:33
                }
            }
           
        }else{//sid
            for(i=0;i<count;i++){
                if(strcmp(stu[i].sid,s)==0){
                    del++;
                   
                    //自i+1开始,添加序列均自减1
                    for(j=i+1;j<count;j++){
                        stu[j].add--;
                    }
                   
                    stu[i]=stu[count-1];
                    count--;
                    break;
                }
            }
            processing();
        }
        printf("%d student(s) removed.\n",del);
    }
}

//print out all the matching students, in the same order they’re added to the database.
void query(){
    int i;
    int sum;
    float avr;
    char s[30];
    while(1){
        printf("Please enter SID or name. Enter 0 to finish.\n");
        scanf("%s",s);
        if(strcmp(s,"0")==0){
            break;
        }
        if(s[0]>='A'&&s[0]<='Z'){//姓名
            for(i=0;i<count;i++){
                if(strcmp(stu[i].name,s)==0){
                    printf("%d %s %d %s %d %d %d %d %d %.2f\n",stu[i].rank,stu[i].sid,stu[i].cid,stu[i].name,stu[i].chinese,stu[i].math,stu[i].english,stu[i].programming,stu[i].sum,stu[i].avr);
                }
            }
        }else{//sid
            for(i=0;i<count;i++){
                if(strcmp(stu[i].sid,s)==0){
                    printf("%d %s %d %s %d %d %d %d %d %.2f\n",stu[i].rank,stu[i].sid,stu[i].cid,stu[i].name,stu[i].chinese,stu[i].math,stu[i].english,stu[i].programming,stu[i].sum,stu[i].avr);
                }
            }
        }
    }
   
}
void ranking(){
    printf("Showing the ranklist hurts students' self-esteem. Don't do that.\n");
}
void statistics(){
    int select;
    printf("Please enter class ID, 0 for the whole statistics.\n");
    scanf("%d",&select);

    if(select&&clinfo[select].num>0){//非0
        printf("Chinese\nAverage Score: %.2f\nNumber of passed students: %d\nNumber of failed students: %d\n\n",clinfo[select].chinese_avr,clinfo[select].chinese_p,clinfo[select].chinese_f);
        printf("Mathematics\nAverage Score: %.2f\nNumber of passed students: %d\nNumber of failed students: %d\n\n",clinfo[select].math_avr,clinfo[select].math_p,clinfo[select].math_f);
        printf("English\nAverage Score: %.2f\nNumber of passed students: %d\nNumber of failed students: %d\n\n",clinfo[select].english_avr,clinfo[select].english_p,clinfo[select].english_f);
        printf("Programming\nAverage Score: %.2f\nNumber of passed students: %d\nNumber of failed students: %d\n\n",clinfo[select].programming_avr,clinfo[select].programming_p,clinfo[select].programming_f);
        printf("Overall:\n");
        printf("Number of students who passed all subjects: %d\n",clinfo[select].passed_all);
        printf("Number of students who passed 3 or more subjects: %d\n",clinfo[select].passed_3);
        printf("Number of students who passed 2 or more subjects: %d\n",clinfo[select].passed_2);
        printf("Number of students who passed 1 or more subjects: %d\n",clinfo[select].passed_1);
        printf("Number of students who failed all subjects: %d\n\n",clinfo[select].passed_0);      
    }else{//0
//        print();
        printf("Chinese\nAverage Score: %.2f\nNumber of passed students: %d\nNumber of failed students: %d\n\n",clwhole.chinese_avr,clwhole.chinese_p,clwhole.chinese_f);
        printf("Mathematics\nAverage Score: %.2f\nNumber of passed students: %d\nNumber of failed students: %d\n\n",clwhole.math_avr,clwhole.math_p,clwhole.math_f);
        printf("English\nAverage Score: %.2f\nNumber of passed students: %d\nNumber of failed students: %d\n\n",clwhole.english_avr,clwhole.english_p,clwhole.english_f);
        printf("Programming\nAverage Score: %.2f\nNumber of passed students: %d\nNumber of failed students: %d\n\n",clwhole.programming_avr,clwhole.programming_p,clwhole.programming_f);
        printf("Overall:\n");
        printf("Number of students who passed all subjects: %d\n",clwhole.passed_all);
        printf("Number of students who passed 3 or more subjects: %d\n",clwhole.passed_3);
        printf("Number of students who passed 2 or more subjects: %d\n",clwhole.passed_2);
        printf("Number of students who passed 1 or more subjects: %d\n",clwhole.passed_1);
        printf("Number of students who failed all subjects: %d\n\n",clwhole.passed_0);
    }
}
void exit(){
}
int main(){
    int choice;
   
    do{
        printf("Welcome to Student Performance Management System (SPMS).\n\n");
        printf("1 - Add\n2 - Remove\n3 - Query\n4 - Show ranking\n5 - Show Statistics\n0 - Exit\n\n");
        scanf("%d",&choice);
        switch(choice){
            case 1:
                add();
                break;
            case 2:
                remove();
                break;
            case 3:
                query();
                break;
            case 4:
                ranking();
                break;
            case 5:
                statistics();
                break;
            case 0:
                exit();
                break;
        }
    }while(choice);
   
    return 0;
}

 

 




HDMI设计2----EDID and E-EDID 1,EDID是什么?有什么用? 图1 应用场景 如图1所示的应用场景,PC将视频信号发送 到我们的设备上,经过一系列的传输和切换,设备将视频信号发送到显示器或者投影机上,也就是说,我们的设备位于PC和显示器之间。首先,在输入端,设备需要让PC知道自己是能够接受输入视频信号的,让PC认为自己是一台显示器。如果不这样做的话,PC可能会拒绝输出任何视频信号的(VGA接口不需要EDID也能输出)。除此之外,设备还要告诉PC自己支持的显示时序。而在输出端,当设备需要自建输出时序而不是简单的复制... 阅读详情

相关推荐

国内网络环境下Calico v3.26.4安装避坑指南(附华为云镜像加速脚本)

本文为国内开发者提供Calico v3.26.4的高效部署指南,重点介绍如何通过华为云镜像加速服务解决Kubernetes集群网络插件镜像拉取问题。文章包含详细的镜像加速脚本、部署清单修改方法及深度排错技巧,帮助开发者快速完成Calico网络插件的安装与配置。

brown的博客 296

HDU4506 小明系列故事——师兄帮帮忙

问题链接:HDU4506 小明系列故事——师兄帮帮忙。 问题描述:参见上述链接。 问题分析:(略)。 程序说明:函数powermod()是快速模幂函数。 AC的C++语言程序如下: /* HDU4506 小明系列故事——师兄帮帮忙 */ #include <iostream> using namespace std; typedef un...

weixin_33717298的博客 215

别再用RIDE了!VSCode+RobotFramework插件打造现代化测试开发环境

本文介绍了如何利用VSCode和RobotFramework插件构建现代化的测试开发环境,替代老旧的RIDE工具。详细讲解了环境配置、插件安装、智能代码补全、测试运行与调试等核心功能,帮助开发者提升自动化测试效率。文章还提供了高级技巧、最佳实践和常见问题解决方案,助力团队实现平滑迁移。

weixin_28829629的博客 488

例3-6 大师兄帮帮忙(UVa12412)

#include<iostream> #include<cstdio> #include<iomanip> #include<string> #include<algorithm> #include<vector> #include<cstring> using namespace std; #define EPS 1e-5 typedef struct STU { char SID[12]; short CID; .

weixin_46273288的博客 260

血管分割中的直径平衡难题:从clDice到cbDice的演进与实践

本文探讨了血管分割中的直径平衡难题,详细分析了从clDice到cbDice的技术演进与实践。通过引入半径感知权重和边界对齐惩罚,cbDice在保持拓扑完整性的同时提升了几何敏感度,显著改善了细小血管的分割效果。文章还分享了在nnU-Net中实现cbDice的工程细节,包括GPU加速骨架提取和多任务损失组合策略,为医学影像分析提供了重要参考。

weixin_29170327的博客 255

例题4-6 UVA12412 师兄帮帮忙(156行AC代码)

紫书刷题进行中,题解系列点这里 例题4-6 UVA12412 师兄帮帮忙 思路分析 只需按部就班实现各个功能,虽然繁琐,但无难点。深入思考有助于提高编程能力。 虽实现容易,但新手和老手在效率和代码长度会存在很大差异,以下对比三份代码实现思路: 比较项目 我的代码 日沉云起 刘汝佳 存储 vectorstu vectorstu 拆分为多个属性数组 插入 维护sidMap,查询是否...

努力做个书呆儿 515

​​手把手教你学PCIE--ATU 的 Bar 匹配模式与地址匹配模式详解​

摘要: ATU(地址转换单元)提供两种地址匹配模式:Bar匹配模式基于PCI设备的BAR寄存器自动映射虚拟地址(只需配置物理基址),适用于标准PCI设备DMA;地址匹配模式需显式配置虚拟与物理地址范围,适合自定义映射场景。核心区别在于匹配依据(BAR自动推导vs人工定义),Bar模式简化配置,地址模式更灵活。

MHD0815的博客 387

UVa12412 - A Typical Homework (a.k.a Shi Xiong Bang Bang Mang)

wrong answer很奇怪 代码如下: #include #include #include #include #include #include #include using namespace std; const double EPS = 1e-5; struct Student { string sid; int cid; string name; in

多看多听多总结 1075

【python科研数据处理】将Endnote自动搜索的所有pdf文件,全都移动指定文件夹中

将Endnote自动搜索到的全部pdf文件,全都移动指定文件夹中1 背景2 问题解决 手动反爬虫,禁止转载:原博地址 https://blog.csdn.net/lys_828/article/details/122370892(CSDN博主:Be_melting) 知识梳理不易,请尊重劳动成果,文章仅发布在CSDN网站上,在其他网站看到该博文均属于未经作者授权的恶意爬取信息 1 背景 在进行期末考试周后,面对最后一门功课,需要提交至少80篇SCI参考文献,因此最快下载文献的方式就是通过Web of S

lys_828的博客 1830

Openclaw第3章:进阶部署

本章面向需要在特定环境中稳定运行 OpenClaw 的用户,介绍 Windows、Linux、Docker 以及 Cloudflare Workers 四种进阶部署方式。每种方式各有侧重:Windows 部署适合桌面用户日常使用,Linux 部署适合开发者,Docker 部署适合追求环境隔离的运维场景,Cloudflare Workers 部署则适合希望获得全球边缘网络加速的用户。读者可根据自身环境和需求选择合适的方案,完成本章后可继续阅读第4章了解维护升级流程。

Maynor的博客 1302

算法竞赛入门经典(第2版)例题4-6 师兄帮帮忙 (A Typical Homework UVa 12412)

这道例题书上要求自己补全daim有个bug卡了我

archya的专栏 2902

STM32芯片解锁读写保护:更改Option Byte [Error已解决]

解锁读保护:STLink更改Option Byte 变Level从1变为0,点击Apply即可。(程序执行读保护,其实是将Level从0变为1) 默认情况下该保护功能是不开启的,若要开启该功能,需要改写内部FLASH选项字节(Option Bytes)中的配置。 RDP读保护级别 级别0,无保护, 级别1,使能读保护, 这种保护下,若使用调试功能(使用下载器、仿真器)或者从内部SRAM自举时都不能对内部FLASH及备份SRAM作任何访问(读写、擦除都被禁止); 当芯片处于级别1的时候,可以把选项字节

HowieXue 薛永浩的博客 2万+

例题4-6 师兄帮帮忙(A Typical Homework (a.k.a Shi Xiong Bang Bang Mang),Rujia Liu's Present 5, UVa 12412)

原题链接:https://vjudge.net/problem/UVA-12412 分类:函数 备注:复杂模拟 分析:特别繁琐,但理解清楚题意后实现起来不难,就是各种细节很麻烦,比如除数为0,它要求输出-nan,并且精度问题很重要,不管是单个人的平均成绩还是单科的平均成绩都要修正精度,看到要输出double的一定要记得精度问题! 代码如下: #include<stdio.h> #inc...

TK_wang_的博客 401

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

[uva 12412]A Typical Homework(师兄帮帮忙)

不得不说,这一题有点6,主要有精度控制和计算平均数时不能除以0这些细节要注意,然而我是跪在了排名函数上,代码略凌乱,希望大家不要介意,就让这题作为我博客的开始吧.

changing___的博客 934

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

4_6 师兄帮帮忙(UVa12412)(选做)

你好,我是外国语学院的本科生。正如你所知道的,编程是一个 在我们大学必修课,即使他/她的专业是远离计算机科学。我根本不喜欢这个 课程,因为我不擅长电脑,我不想有任何编程的尝试! 但我不得不做作业:(嘘你能帮我吗?请保守秘密! 我知道你不会对一个可怜的小女孩说不。) 任务:写的一个学生成绩管理系统(SPMS)。 观念:在SPMS,最多将有100名学生,每个人都有一个SID,CID,姓名和四门...

weixin_30732487的博客 149

Uva12412 师兄帮帮忙

实在不想做这道题了,先扔在这里吧 wa就wa吧,感觉自己是个废人了 感觉大概是格式的问题?反正我代码很烂不管了 #include using namespace std; class Student { public: string sid; int cid,score1,score2,score3,score4,totalscore,rank; string

fanesemyk的博客 933

A Typical Homework UVA - 12412 师兄帮帮忙

题目链接 (题目背景略,有兴趣的读者请自行阅读原题) 编写一个成绩管理系统(SPMS)。最多有100个学生,每个学生有如下属性。 SID:学生编号,包含10位数字。 CID:班级编号,为不超过20的正整数。 姓名:不超过10的字母和数字组成,第一个字符为大写字母。名字中不能有空白字符。 4门课程(语文、数学、英语、编程)成绩,均为不超过100的非负整数。 #include &...

Nicolas的博客 375

师兄帮帮忙 UVa 12412

原题很长,就此略过了 https://vjudge.net/problem/UVA-12412#author=0 这道题看似是一道简单的家庭作业题,其实非常容易出错,且调试时间很长。主要的难点在于: 1. 增加学生成绩记录时调整好整个学生列表的排名Rank值,不用排序 2. 删除学生成绩记录后需要调整学生排名 3. 如何快速高效生成统计数据 #include&lt;stdio.h&g...

u012439764的博客 417

UVA12412 A Typical Homework (a.k.a 师兄帮帮忙) 题解

题意 实现一个学生信息管理系统,完成要求功能,并按要求输出.具体内容可以看[UVA12412](UVA12412 A Typical Homework (a.k.a 师兄帮帮忙) - 洛谷 | 计算机科学教育新生态 (luogu.com.cn)) 输入输出样例 输入 #1 1 0011223344 1 John 79 98 91 100 0022334455 1 Tom 59 72 60 81 0011223344 2 Alice 100 100 100 100 2423475629 2 John 60 8

m0_63486615的博客 580

UVA12412师兄帮帮忙

#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt; #define EPS 1e-5 int N; struct student { int glass; char s[120],name[120]; int Chinese,Math,English,Program,Sum...

沐妖的博客 810

师兄帮帮忙 UVa12412 一个简单的成绩查询问题

师兄帮帮忙 UVa12412题目要求代码部分 题目要求 请自行查阅。 代码部分 用线性结构实现。 #include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> #include <ctype.h> #include <iostream> #include <vector> #include <algorithm> usi

weixin_53356651的博客 164

UVA-12412 师兄帮帮忙 题解答案代码 算法竞赛入门经典第二版

https://github.com/jzplp/aoapc-UVA-Answer 好麻烦的一道题。 题目没说如果在选菜单,query和stat的时候输入的时候如果是错误的怎么办,根据测试知道是重新输出一遍提示语。 #include<cstring> #include<algorithm> #include<cstdio> #include<vector> using namespace std; struct Stu { char sid[13]

Coding home - 漂流瓶jz 569

算法竞赛入门经典(第二版)-刘汝佳-第四章 函数与递归 例题+习题(15/16)

说明本文是我对第四章题目的练习总结,建议配合紫书——《算法竞赛入门经典(第2版)》阅读本文。 另外为了方便做题,我在VOJ上开了一个contest,欢迎一起在上面做:第四章contest 如果想直接看某道题,请点开目录后点开相应的题目!!!例题例4-1 UVA 1339 古老的密码思路 只需要分别统计两个字符串中26个字母出现的个数,然后对统计数组做一个排序,如果一样则结果为YES。 详细解

梁山伯的专栏 4954

UVA12412 A Typical Homework (a.k.a 师兄帮帮忙)

这是一道模拟题,不能提升算法能力,但是能大大提升编程能力,这道题主要就是编写五个函数,一个一个说, 首先是第一个添加函数,这个函数需要注意的是,学生id是不能重复的,也就是这个学生id已经出现过了那么这组数据就不要储存,也即学生id每个都是唯一的,在你储存的数据里面,姓名是不需要去管的,可以重复 第二个是删除函数,上面我们用map映射学生id,现在要删除数据,当我们每删除一个学生的数据,要记得map里面删除相应的映射,表明这个学生id没有了,因为学生id是唯一的,所以我们删除几个数据,就要删除几个学生id,

qq_33942309的博客 253

UVA - 12412,A Typical Homework (a.k.a Shi Xiong Bang Bang Mang)

题巨长,但是不难,一个bug调了好长时间,终于ac了。浮点数加上1e-5;当数据库空的时候直接输出0.00(虽然udebug里是输出nan);还有选操作4时输出的单引号应该是英文的,样例给的是中文的。 传送门:UVA-12412 AC代码:   #include&lt;iostream&gt; #include&lt;map&gt; #include&lt;algorithm&gt; #i...

weixin_42547447的博客 344

例题5-10 PGA巡回赛的奖金 UVa207

算法竞赛入门经典(第2版) 第5章C++与STL入门 例题5-10 PGA巡回赛的奖金  UVa207 感悟。 1、从网站下载英文原题,重点在看输入输出数据与格式。 2、

mrcrack的博客 1853
上一篇: NOIP2012 提高组 复赛 day1 game
下一篇: 习题4-1 象棋 uva1589
mrcrack
博客等级 码龄15年 1072粉丝 1063原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值