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

【刘汝佳书】例题4-6 UVA12412 【2019.3.29】 感觉是第一次完全独立写这么长的代码, 貌似当年C语言程序设计大作业的代码也就这么长, 以前虽然写过更长的,但或多或少都参考了网上的代码, 中间大修了若干次,小修了无数次,产生了各种各样的error, 大概写了四个小时,306行代码,应该还能再简化, 其实这道题用链表更合适,但懒得改了, 以后做题一定要看完全文再写, 不然就会产生中途修改的事。 有几个需要注意的地方: 1、S... 阅读详情

这道例题书上要求自己补全代码,因此也当做一道习题来完成。

wa卡了我好几天,最后通过与网上找到的标程对拍才发现是当数据库被清空后统计函数会出现除0的错误。

其实对拍之前读标程的时候已经注意到这点了,但是自己居然以为已经处理好了......

改好程序后顺利通过对拍,再上传还是wa,重新写了测试数据后,发现数据库被完全清空后再添加记录我的程序全报duplicated,改掉bug后第二次上传顺利AC。

后来发现第二个bug官方测试数据是查不出来的,第一次上传后wa其实是因为当时我没注释#define LOCAL ...囧


//#define LOCAL
//#define TESTING
#include<stdio.h>
#include<string.h>
#define maxl 10000
#define EPS 0.00001

int score[maxl][10];//score[][0,1,2,3,4] 分别为(Chinese成绩, Mathematics成绩, English成绩, Programming成绩,总分)
int removed[maxl];//删除状态标识
int n;//数据库中包含的学生信息数量
int cid[maxl];//班级编号
char sid[maxl][99], name[maxl][99];//sid:学生编号 name:学生姓名

void print_menu()//打印目录函数
{
    printf("Welcome to Student Performance Management System (SPMS).\n\n");
    printf("1 - Add\n");
    printf("2 - Remove\n");
    printf("3 - Query\n");
    printf("4 - Show ranking\n");
    printf("5 - Show Statistics\n");
    printf("0 - Exit\n\n");
    return;
}

void add()
{
    char s[maxl];
    for(;;)
    {   
        bool dup = 0;
        memset(s,0,sizeof(s));
        printf("Please enter the SID, CID, name and four scores. Enter 0 to finish.\n");
        scanf("%s", s);
        #ifdef TESTING
        printf("T:input=%s\n", s);
        #endif
        if(strcmp(s, "0") == 0) break;
        //覆盖已删除数据
        int indfre = -1;
        if(n)
        {
            bool firstre = false;
            
             for(int i = 0; i <n; i++)
            {
                if(removed[i]&&!firstre)
                {
                    firstre = true;
                    indfre = i;
                }
                if(firstre&&!removed[i])
                {
                    removed[i] = true;
                    for(int j = 0; j <= 10; j++) sid[indfre][j]=sid[i][j];
                    cid[indfre] = cid[i];
                    for(int j = 0; j <= 10; j++) name[indfre][j]=name[i][j];
                    for(int j = 0; j <= 4; j++) score[indfre][j] = score[i][j];
                    removed[indfre] = false;
                    #ifdef TESTING
                    printf("i=%d n=%d indfre=%d\n", i, n, indfre);
                    printf("T:record[%d]: %s %d %s %d %d %d %d %d %.2f\n", indfre, sid[indfre],
                    cid[indfre], name[indfre], score[indfre][0], score[indfre][1], score[indfre][2], score[indfre][3],
                    score[indfre][4], score[indfre][4]/4.0+EPS);
                    #endif
                    indfre++;
                }
                if((indfre == 0)&&removed[i]&&(n-i)==1) n = 0;
            }
        }
        if(indfre>0) n = indfre;
        //覆盖已删除数据结束
        //查重
        if(n)
        {
            for(int i = 0; i <n; i++) 
            {
                if(strcmp(s, sid[i]) == 0)
                {
                    printf("Duplicated SID.\n");
                    #ifdef TESTING
                    printf("i=%d n=%d\n", i, n);
                    #endif
                    dup = true;
                    break;
                }
            }
        }
        if(dup)
        {
            int drop;
            char drops[maxl];
            scanf("%d%s%d%d%d%d",&drop,drops,&drop,&drop,&drop,&drop);
            continue;
        }
        //查重结束
        //添加数据
        if(removed[n]) removed[n] = false;
        for(int i = 0; i <= 10; i++) sid[n][i]=s[i];
        #ifdef TESTING
        printf("T:s=%s sid=%s\n", s, sid[n]);
        #endif
        scanf("%d", &cid[n]);
        scanf("%s", name[n]);
        scanf("%d%d%d%d", &score[n][0], &score[n][1], &score[n][2], &score[n][3]);
        score[n][4] = 0;
        for(int i = 0; i < 4; i++) score[n][4] += score[n][i];
        #ifdef TESTING
        printf("T:record[%d]: %s %d %s %d %d %d %d %d %.2f\n", n, sid[n],
                cid[n], name[n], score[n][0], score[n][1], score[n][2], score[n][3],
                score[n][4], score[n][4]/4.0+EPS);
        #endif
        n++;
        //添加数据结束
    }
    return;
}

int rank(int rec)
{
    int ranking = 1;
    for(int i = 0; i < n; i++)if(!removed[i])
    {
        if(score[rec][4] < score[i][4]) ranking++;
    }
    return ranking;
}


void DQ(int isq)//声明删除查询函数DQ 参数 整型变量 isq:查询指令标识 isq=1表示查询 isq=0表示删除
{
    char s[maxl];
    for(;;)
    {
        printf("Please enter SID or name. Enter 0 to finish.\n");//输出提示信息
        scanf("%s", s);
        #ifdef TESTING
        printf("T:input=%s\n", s);
        #endif
        if(strcmp(s, "0") == 0) break;
        int r = 0;
        for(int i = 0; i < n; i++) if(!removed[i])
        {
            if(strcmp(sid[i], s) == 0 || strcmp(name[i], s) == 0)
            {
                if(isq) printf("%d %s %d %s %d %d %d %d %d %.2f\n", rank(i), sid[i],
                cid[i], name[i], score[i][0], score[i][1], score[i][2], score[i][3],
                score[i][4], score[i][4]/4.0+EPS);
                else { removed[i] = 1; r++;}
            }
        }
        if(!isq) printf("%d student(s) removed.\n",r);
    }
}

void stat()
{
    int c;
    int sumsc[10],pasc[10],fasc[10],pass[10],tot = 0;
    char kemu[10][30] = {"Chinese","Mathematics","English","Programming"};
    char as[] = "Average Score: ";
    char np[] = "Number of passed students: ";
    char nf[] = "Number of failed students: ";
    
    memset(sumsc,0,sizeof(sumsc));
    memset(pasc,0,sizeof(pasc));
    memset(fasc,0,sizeof(fasc));
    memset(pass,0,sizeof(pass));
    printf("Please enter class ID, 0 for the whole statistics.\n");
    scanf("%d", &c);
    #ifdef TESTING
    printf("T:input=%d\n", c);
    #endif
    for(int i = 0; i < n; i++) if(!removed[i])
    {
        if(cid[i]== c|| c == 0)
        {
            
            int passed = 4;
            for(int j = 0; j < 4; j++)
            {
                sumsc[j] += score[i][j];
                if(score[i][j] >= 60) pasc[j]++;
                else
                {
                    passed--;
                    fasc[j]++;
                }
            }
            if(passed == 4) {pass[4]++;pass[3]++;pass[2]++;pass[1]++;}
            else if(passed == 3) {pass[3]++;pass[2]++;pass[1]++;}
            else if(passed == 2) {pass[2]++;pass[1]++;}
            else if(passed == 1) pass[1]++;
            else pass[0]++;
            tot++;
        }
        #ifdef TESTING
        printf("T:i=%d tot=%d\n", i, tot);
        #endif
    }
    if(n)
    {
        for(int i = 0; i < 4; i++)
        {
            double avsc;
            if(tot) avsc=sumsc[i]*1.0/tot+EPS;
            else avsc = 0.0;
            printf("%s\n%s%.2lf\n", kemu[i],as,avsc+EPS);
            printf("%s%d\n", np, pasc[i]);
            printf("%s%d\n\n", nf, fasc[i]);
        }
        printf("Overall:\nNumber of students who passed all subjects: %d\n",pass[4]);
        printf("Number of students who passed 3 or more subjects: %d\n",pass[3]);
        printf("Number of students who passed 2 or more subjects: %d\n",pass[2]);
        printf("Number of students who passed 1 or more subjects: %d\n",pass[1]);
        printf("Number of students who failed all subjects: %d\n\n",pass[0]);
    }
}
#ifdef TESTING
void showranking()
{
    printf("Showing the ranklist hurts students' self-esteem. Do that.\n");
    int ranking[maxl], last=1;
    for(int i = 0; i < maxl; i++) ranking[i] = 1;
    
    for(int i = 0; i < n; i++)if(!removed[i])
    {
        for(int j = 0; j < n ; j++)if(!removed[j])
        {
            if(score[i][4] < score[j][4])
            {
                ranking[i]++;
                printf("i=%d j=%d ranking=%d\n",i,j,ranking[i]);
            }
        }
        if(last < ranking[i]) last = ranking[i];
    }
    int pranking = 1;
    for(int j = 0; j <last; j++)
    {
        for(int i = 0; i < n; i++)if(!removed[i])
        {
                if(ranking[i]==pranking)
                {
                    printf("i=%d rank=%d pranking=%d %s %d %s %d %d %d %d %d %.2f\n", i, ranking[i], pranking, sid[i],
                            cid[i], name[i], score[i][0], score[i][1], score[i][2], score[i][3],
                            score[i][4], score[i][4]/4.0+EPS);
                }
        }
        pranking++;
    }
}
#endif

int main()
{
    #ifdef LOCAL
    freopen("lt4-6.in","r",stdin);
    freopen("lt4-6.out","w",stdout);
    #endif
    memset(score,0,sizeof(score));
    memset(removed,0,sizeof(removed));
    memset(cid,0,sizeof(cid));
    memset(sid,0,sizeof(sid));
    memset(name,0,sizeof(name));
    for(;;)
    {
        int choice;//声明整型变量choice:操作选项
        print_menu();//执行打印目录函数
        scanf("%d", &choice);//读入一个整数 赋值给操作选项choice函数
        #ifdef TESTING
        printf("T:choice=%d\n", choice);
        #endif
        if(choice == 0) break;//如果操作选项为0,终止程序
        if(choice == 1) add();//如果操作选项为1,执行添加函数 add()
        if(choice == 2) DQ(0);//如果操作选项为2,执行删除查询函数DQ() 参数0(删除功能)
        if(choice == 3) DQ(1);//如果操作选项为3,执行删除查询函数DQ() 参数1(查询功能)
        if(choice == 4) printf("Showing the ranklist hurts students' self-esteem. Don't do that.\n");
        //如果操作选项为4 输出提示信息
        if(choice == 5) stat();////如果操作选项为5,执行统计函数 stat()
        #ifdef TESTING
        if(choice == 6) showranking();
        #endif
    }
    return 0;
}

对拍时参考的标程(来源:http://blog.tobygameac.com/2013/08/uva-12412-typical-homework-aka-shi.html)

#include <cstdio>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#define PB push_back
using namespace std;

typedef string Course;

class Student {
 public:

  Student(string SID, int CID, string name, vector<int> scores) : SID(SID), CID(CID), name(name), scores(scores) {
    total = 0;
    for (int i = 0; i < scores.size(); i++) {
      total += scores[i];
    }
    average = total / (double)scores.size();
  }

  string SID, name;
  int CID;
  vector<int> scores;
  int total;
  double average;
};

class SPMS {
 public:

  SPMS(vector<Course> courses) : courses(courses) {}

  void run() {
    int option = -1;
    do {
      switch (option) {
       case 1:
        add();
        break;
       case 2:
        remove();
        break;
       case 3:
        query();
        break;
       case 4:
        showRanking();
        break;
       case 5:
        showStatics();
        break;
      }
      puts("Welcome to Student Performance Management System (SPMS).\n");
      puts("1 - Add");
      puts("2 - Remove");
      puts("3 - Query");
      puts("4 - Show ranking");
      puts("5 - Show Statistics");
      puts("0 - Exit");
      puts("");
    } while (scanf("%d", &option) && option);
  }

 private:

  void add() {
    char SID[99];
    puts("Please enter the SID, CID, name and four scores. Enter 0 to finish.");
    while (scanf("%s", SID) && string(SID) != "0") {
      int CID;
      char name[99];
      vector<int> scores;
      scanf("%d%s", &CID, name);
      for (int i = 0; i < courses.size(); i++) {
        int score;
        scanf("%d", &score);
        scores.PB(score);
      }
      bool already = false;
      for (int i = 0; i < students.size() && !already; i++) {
        already = (students[i].SID == SID);
      }
      if (already) {
        puts("Duplicated SID.");
      } else {
        students.PB(Student(SID, CID, name, scores));
      }
      puts("Please enter the SID, CID, name and four scores. Enter 0 to finish.");
    }
  }

  void remove() {
    char keyword[99];
    puts("Please enter SID or name. Enter 0 to finish.");
    while (scanf("%s", keyword) && string(keyword) != "0") {
      int removedNum = 0;
      for (int i = 0; i < students.size(); i++) {
        Student & student = students[i];
        if ((student.SID == keyword) || (student.name == keyword)) {
          students.erase(students.begin() + i--);
          removedNum++;
        }
      }
      printf("%d student(s) removed.\n", removedNum);
      puts("Please enter SID or name. Enter 0 to finish.");
    }
  }

  void query() {
    char keyword[99];
    puts("Please enter SID or name. Enter 0 to finish.");
    while (scanf("%s", keyword) && string(keyword) != "0") {
      adjustRank();
      for (int i = 0; i < students.size(); i++) {
        Student & student = students[i];
        if ((student.SID == keyword) || (student.name == keyword)) {
          printf("%d %s %d %s", rankOfScore[student.total], student.SID.c_str(), student.CID, student.name.c_str());
          for (int j = 0; j < student.scores.size(); j++) {
            printf(" %d", student.scores[j]);
          }
          printf(" %d %.2lf\n", student.total, student.average + 1e-5);
        }
      }
      puts("Please enter SID or name. Enter 0 to finish.");
    }
  }

  void showRanking() {
    puts("Showing the ranklist hurts students' self-esteem. Don't do that.");
  }

  void showStatics() {
    puts("Please enter class ID, 0 for the whole statistics.");
    int CID;
    scanf("%d", &CID);
    for (int c = 0; c < courses.size(); c++) {
      puts(courses[c].c_str());
      int num = 0, total = 0, passed = 0;
      for (int i = 0; i < students.size(); i++) {
        Student & student = students[i];
        if (!CID || (student.CID == CID)) {
          num++;
          total += student.scores[c];
          passed += (student.scores[c] >= 60);
        }
      }
      printf("Average Score: %.2lf\n", total / (double)(num == 0 ? 1 : num) + 1e-5);
      printf("Number of passed students: %d\n", passed);
      printf("Number of failed students: %d\n", num - passed);
      puts("");
    }
    vector<int> passedNum(courses.size() + 1, 0);
    for (int i = 0; i < students.size(); i++) {
      Student & student = students[i];
      if (!CID || (student.CID == CID)) {
        int passed = 0;
        for (int c = 0; c < courses.size(); c++) {
          passed += (student.scores[c] >= 60);
        }
        passedNum[passed]++;
      }
    }
    puts("Overall:");
    printf("Number of students who passed all subjects: %d\n", passedNum.back());
    for (int i = passedNum.size() - 2; i > 0; i--) {
      passedNum[i] += passedNum[i + 1];
      printf("Number of students who passed %d or more subjects: %d\n", i, passedNum[i]);
    }
    printf("Number of students who failed all subjects: %d\n", passedNum[0]);
    puts("");
  }

  void adjustRank() {
    rankOfScore.clear();
    vector<int> allScores;
    for (int i = 0; i < students.size(); i++) {
      allScores.PB(students[i].total);
    }
    sort(allScores.begin(), allScores.end());
    reverse(allScores.begin(), allScores.end());
    for (int i = 0; i < allScores.size(); i++) {
      if (rankOfScore.find(allScores[i]) == rankOfScore.end()) {
        rankOfScore[allScores[i]] = i + 1;
      }
    }
  }

  vector<Course> courses;
  vector<Student> students;
  map<int, int> rankOfScore;
};

int main() {
  vector<Course> courses;
  courses.PB("Chinese");
  courses.PB("Mathematics");
  courses.PB("English");
  courses.PB("Programming");
  SPMS spms(courses);
  spms.run();
  return 0;
}

测试数据:

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 80 30 99
0
2
John
Tom
0
1
0011223344 1 John 79 98 91 100
0
1
0000000001 1 AA 1 2 3 4
0000000002 2 AB 2 3 4 5
0000000003 3 AC 3 4 5 6
0000000004 4 AA 4 5 6 7
0000000005 5 AB 5 6 7 8
0000000006 6 AC 6 7 8 9
0000000007 7 AA 7 8 9 10
0000000008 8 AB 8 9 10 11
0000000009 9 AC 9 10 11 12
0000000010 10 AA 10 11 12 13
0000000011 11 AB 11 12 13 14
0000000012 12 AC 12 13 14 15
0000000013 13 AA 13 14 15 16
0000000014 14 AB 14 15 16 17
0000000015 15 AC 15 16 17 18
0000000016 16 AA 16 17 18 19
0000000017 17 AB 17 18 19 20
0000000018 18 AC 18 19 20 21
0000000019 19 AA 19 20 21 22
0000000020 20 AB 20 21 22 23
0000000021 1 AC 21 22 23 24
0000000022 2 AA 22 23 24 25
0000000023 3 AB 23 24 25 26
0000000024 4 AC 24 25 26 27
0000000025 5 AA 25 26 27 28
0000000026 6 AB 26 27 28 29
0000000027 7 AC 27 28 29 30
0000000028 8 AA 28 29 30 31
0000000029 9 AB 29 30 31 32
0000000030 10 AC 30 31 32 33
0000000031 11 AA 31 32 33 34
0000000032 12 AB 32 33 34 35
0000000033 13 AC 33 34 35 36
0000000034 14 AA 34 35 36 37
0000000035 15 AB 35 36 37 38
0000000036 16 AC 36 37 38 39
0000000037 17 AA 37 38 39 40
0000000038 18 AB 38 39 40 41
0000000039 19 AC 39 40 41 42
0000000040 20 AA 40 41 42 43
0000000041 1 AB 41 42 43 44
0000000042 2 AC 42 43 44 45
0000000043 3 AA 43 44 45 46
0000000044 4 AB 44 45 46 47
0000000045 5 AC 45 46 47 48
0000000046 6 AA 46 47 48 49
0000000047 7 AB 47 48 49 50
0000000048 8 AC 48 49 50 51
0000000049 9 AA 49 50 51 52
0000000050 10 AB 50 51 52 53
0000000051 11 AC 51 52 53 54
0000000052 12 AA 52 53 54 55
0000000053 13 AB 53 54 55 56
0000000054 14 AC 54 55 56 57
0000000055 15 AA 55 56 57 58
0000000056 16 AB 56 57 58 59
0000000057 17 AC 57 58 59 60
0000000058 18 AA 58 59 60 61
0000000059 19 AB 59 60 61 62
0000000060 20 AC 60 61 62 63
0000000061 1 AA 61 62 63 64
0000000062 2 AB 62 63 64 65
0000000063 3 AC 63 64 65 66
0000000064 4 AA 64 65 66 67
0000000065 5 AB 65 66 67 68
0000000066 6 AC 66 67 68 69
0000000067 7 AA 67 68 69 70
0000000068 8 AB 68 69 70 71
0000000069 9 AC 69 70 71 72
0000000070 10 AA 70 71 72 73
0000000071 11 AB 71 72 73 74
0000000072 12 AC 72 73 74 75
0000000073 13 AA 73 74 75 76
0000000074 14 AB 74 75 76 77
0000000075 15 AC 75 76 77 78
0000000076 16 AA 76 77 78 79
0000000077 17 AB 77 78 79 80
0000000078 18 AC 78 79 80 81
0000000079 19 AA 79 80 81 82
0000000080 20 AB 80 81 82 83
0000000081 1 AC 81 82 83 84
0000000082 2 AA 82 83 84 85
0000000083 3 AB 83 84 85 86
0000000084 4 AC 84 85 86 87
0000000085 5 AA 85 86 87 88
0000000086 6 AB 86 87 88 89
0000000087 7 AC 87 88 89 90
0000000088 8 AA 88 89 90 91
0000000089 9 AB 89 90 91 92
0000000090 10 AC 90 91 92 93
0000000091 11 AA 91 92 93 94
0000000092 12 AB 92 93 94 95
0000000093 13 AC 93 94 95 96
0000000094 14 AA 94 95 96 97
0000000095 15 AB 95 96 97 98
0000000096 16 AC 96 97 98 99
0000000097 17 AA 97 98 99 100
0000000098 18 AB 98 99 100 1
0000000099 19 AC 99 100 1 2
0000000100 20 AA 100 1 2 3
0
3
0022334455
John
0
5
1
2
0011223344
0
5
0
4
5
1
5
2
5
3
5
4
5
6
5
20
2
AA
0
1
0000000001 1 AA 1 2 3 4
0000000002 2 AB 2 3 4 5
0000000003 3 AC 3 4 5 6
0000000004 4 AA 4 5 6 7
0000000005 5 AB 5 6 7 8
0000000006 6 AC 6 7 8 9
0000000007 7 AA 7 8 9 10
0000000008 8 AB 8 9 10 11
0000000009 9 AC 9 10 11 12
0000000010 10 AA 10 11 12 13
0000000011 11 AB 11 12 13 14
0000000012 12 AC 12 13 14 15
0000000013 13 AA 13 14 15 16
0000000014 14 AB 14 15 16 17
0000000015 15 AC 15 16 17 18
0000000016 16 AA 16 17 18 19
0000000017 17 AB 17 18 19 20
0000000018 18 AC 18 19 20 21
0000000019 19 AA 19 20 21 22
0000000020 20 AB 20 21 22 23
0000000021 1 AC 21 22 23 24
0000000022 2 AA 22 23 24 25
0000000023 3 AB 23 24 25 26
0000000024 4 AC 24 25 26 27
0000000025 5 AA 25 26 27 28
0000000026 6 AB 26 27 28 29
0000000027 7 AC 27 28 29 30
0000000028 8 AA 28 29 30 31
0000000029 9 AB 29 30 31 32
0000000030 10 AC 30 31 32 33
0000000031 11 AA 31 32 33 34
0000000032 12 AB 32 33 34 35
0000000033 13 AC 33 34 35 36
0000000034 14 AA 34 35 36 37
0000000035 15 AB 35 36 37 38
0000000036 16 AC 36 37 38 39
0000000037 17 AA 37 38 39 40
0000000038 18 AB 38 39 40 41
0000000039 19 AC 39 40 41 42
0000000040 20 AA 40 41 42 43
0000000041 1 AB 41 42 43 44
0000000042 2 AC 42 43 44 45
0000000043 3 AA 43 44 45 46
0000000044 4 AB 44 45 46 47
0000000045 5 AC 45 46 47 48
0000000046 6 AA 46 47 48 49
0000000047 7 AB 47 48 49 50
0000000048 8 AC 48 49 50 51
0000000049 9 AA 49 50 51 52
0000000050 10 AB 50 51 52 53
0000000051 11 AC 51 52 53 54
0000000052 12 AA 52 53 54 55
0000000053 13 AB 53 54 55 56
0000000054 14 AC 54 55 56 57
0000000055 15 AA 55 56 57 58
0000000056 16 AB 56 57 58 59
0000000057 17 AC 57 58 59 60
0000000058 18 AA 58 59 60 61
0000000059 19 AB 59 60 61 62
0000000060 20 AC 60 61 62 63
0000000061 1 AA 61 62 63 64
0000000062 2 AB 62 63 64 65
0000000063 3 AC 63 64 65 66
0000000064 4 AA 64 65 66 67
0000000065 5 AB 65 66 67 68
0000000066 6 AC 66 67 68 69
0000000067 7 AA 67 68 69 70
0000000068 8 AB 68 69 70 71
0000000069 9 AC 69 70 71 72
0000000070 10 AA 70 71 72 73
0000000071 11 AB 71 72 73 74
0000000072 12 AC 72 73 74 75
0000000073 13 AA 73 74 75 76
0000000074 14 AB 74 75 76 77
0000000075 15 AC 75 76 77 78
0000000076 16 AA 76 77 78 79
0000000077 17 AB 77 78 79 80
0000000078 18 AC 78 79 80 81
0000000079 19 AA 79 80 81 82
0000000080 20 AB 80 81 82 83
0000000081 1 AC 81 82 83 84
0000000082 2 AA 82 83 84 85
0000000083 3 AB 83 84 85 86
0000000084 4 AC 84 85 86 87
0000000085 5 AA 85 86 87 88
0000000086 6 AB 86 87 88 89
0000000087 7 AC 87 88 89 90
0000000088 8 AA 88 89 90 91
0000000089 9 AB 89 90 91 92
0000000090 10 AC 90 91 92 93
0000000091 11 AA 91 92 93 94
0000000092 12 AB 92 93 94 95
0000000093 13 AC 93 94 95 96
0000000094 14 AA 94 95 96 97
0000000095 15 AB 95 96 97 98
0000000096 16 AC 96 97 98 99
0000000097 17 AA 97 98 99 100
0000000098 18 AB 98 99 100 1
0000000099 19 AC 99 100 1 2
0000000100 20 AA 100 1 2 3
0
2
AC
0
1
0000000001 1 AA 1 2 3 4
0000000002 2 AB 2 3 4 5
0000000003 3 AC 3 4 5 6
0000000004 4 AA 4 5 6 7
0000000005 5 AB 5 6 7 8
0000000006 6 AC 6 7 8 9
0000000007 7 AA 7 8 9 10
0000000008 8 AB 8 9 10 11
0000000009 9 AC 9 10 11 12
0000000010 10 AA 10 11 12 13
0000000011 11 AB 11 12 13 14
0000000012 12 AC 12 13 14 15
0000000013 13 AA 13 14 15 16
0000000014 14 AB 14 15 16 17
0000000015 15 AC 15 16 17 18
0000000016 16 AA 16 17 18 19
0000000017 17 AB 17 18 19 20
0000000018 18 AC 18 19 20 21
0000000019 19 AA 19 20 21 22
0000000020 20 AB 20 21 22 23
0000000021 1 AC 21 22 23 24
0000000022 2 AA 22 23 24 25
0000000023 3 AB 23 24 25 26
0000000024 4 AC 24 25 26 27
0000000025 5 AA 25 26 27 28
0000000026 6 AB 26 27 28 29
0000000027 7 AC 27 28 29 30
0000000028 8 AA 28 29 30 31
0000000029 9 AB 29 30 31 32
0000000030 10 AC 30 31 32 33
0000000031 11 AA 31 32 33 34
0000000032 12 AB 32 33 34 35
0000000033 13 AC 33 34 35 36
0000000034 14 AA 34 35 36 37
0000000035 15 AB 35 36 37 38
0000000036 16 AC 36 37 38 39
0000000037 17 AA 37 38 39 40
0000000038 18 AB 38 39 40 41
0000000039 19 AC 39 40 41 42
0000000040 20 AA 40 41 42 43
0000000041 1 AB 41 42 43 44
0000000042 2 AC 42 43 44 45
0000000043 3 AA 43 44 45 46
0000000044 4 AB 44 45 46 47
0000000045 5 AC 45 46 47 48
0000000046 6 AA 46 47 48 49
0000000047 7 AB 47 48 49 50
0000000048 8 AC 48 49 50 51
0000000049 9 AA 49 50 51 52
0000000050 10 AB 50 51 52 53
0000000051 11 AC 51 52 53 54
0000000052 12 AA 52 53 54 55
0000000053 13 AB 53 54 55 56
0000000054 14 AC 54 55 56 57
0000000055 15 AA 55 56 57 58
0000000056 16 AB 56 57 58 59
0000000057 17 AC 57 58 59 60
0000000058 18 AA 58 59 60 61
0000000059 19 AB 59 60 61 62
0000000060 20 AC 60 61 62 63
0000000061 1 AA 61 62 63 64
0000000062 2 AB 62 63 64 65
0000000063 3 AC 63 64 65 66
0000000064 4 AA 64 65 66 67
0000000065 5 AB 65 66 67 68
0000000066 6 AC 66 67 68 69
0000000067 7 AA 67 68 69 70
0000000068 8 AB 68 69 70 71
0000000069 9 AC 69 70 71 72
0000000070 10 AA 70 71 72 73
0000000071 11 AB 71 72 73 74
0000000072 12 AC 72 73 74 75
0000000073 13 AA 73 74 75 76
0000000074 14 AB 74 75 76 77
0000000075 15 AC 75 76 77 78
0000000076 16 AA 76 77 78 79
0000000077 17 AB 77 78 79 80
0000000078 18 AC 78 79 80 81
0000000079 19 AA 79 80 81 82
0000000080 20 AB 80 81 82 83
0000000081 1 AC 81 82 83 84
0000000082 2 AA 82 83 84 85
0000000083 3 AB 83 84 85 86
0000000084 4 AC 84 85 86 87
0000000085 5 AA 85 86 87 88
0000000086 6 AB 86 87 88 89
0000000087 7 AC 87 88 89 90
0000000088 8 AA 88 89 90 91
0000000089 9 AB 89 90 91 92
0000000090 10 AC 90 91 92 93
0000000091 11 AA 91 92 93 94
0000000092 12 AB 92 93 94 95
0000000093 13 AC 93 94 95 96
0000000094 14 AA 94 95 96 97
0000000095 15 AB 95 96 97 98
0000000096 16 AC 96 97 98 99
0000000097 17 AA 97 98 99 100
0000000098 18 AB 98 99 100 1
0000000099 19 AC 99 100 1 2
0000000100 20 AA 100 1 2 3
0
5
1
5
2
5
3
5
4
5
5
5
6
5
7
5
8
5
9
5
10
5
11
5
12
5
13
5
14
5
15
5
16
5
17
5
18
5
19
5
20
5
0
4
3
AB
AC
AA
AD
John
Tom
0
5
0
2
AB
AC
AA
0
5
0
2
John
Tom
AA
0
5
0
1
0000000001 1 AA2asdffds 1 2 3 4
0000000002 2 AB3459fdsw 2 3 4 5
0000000003 3 AA3asdffds 3 4 5 6
0000000004 4 AB3460fdsw 4 5 6 7
0000000005 5 AA4asdffds 5 6 7 8
0000000006 6 AB3461fdsw 6 7 8 9
0000000007 7 AA5asdffds 7 8 9 10
0000000008 8 AB3462fdsw 8 9 10 11
0000000009 9 AA6asdffds 9 10 11 12
0000000010 10 AA3asdffds 10 11 12 13
0000000011 11 AB3460fdsw 11 12 13 14
0000000012 12 AA4asdffds 12 13 14 15
0000000013 13 AB3461fdsw 13 14 15 16
0000000014 14 AA5asdffds 14 15 16 17
0000000015 15 AB3462fdsw 15 16 17 18
0000000016 16 AA6asdffds 16 17 18 19
0000000017 17 AB3463fdsw 17 18 19 20
0000000018 18 AA7asdffds 18 19 20 21
0000000019 19 AA4asdffds 19 20 21 22
0000000020 20 AB3461fdsw 20 21 22 23
0000000021 1 AA5asdffds 21 22 23 24
0000000022 2 AB3462fdsw 22 23 24 25
0000000023 3 AA6asdffds 23 24 25 26
0000000024 4 AB3463fdsw 24 25 26 27
0000000025 5 AA7asdffds 25 26 27 28
0000000026 6 AB3464fdsw 26 27 28 29
0000000027 7 AA8asdffds 27 28 29 30
0000000028 8 AA5asdffds 28 29 30 31
0000000029 9 AB3462fdsw 29 30 31 32
0000000030 10 AA6asdffds 30 31 32 33
0000000031 11 AB3463fdsw 31 32 33 34
0000000032 12 AA7asdffds 32 33 34 35
0000000033 13 AB3464fdsw 33 34 35 36
0000000034 14 AA8asdffds 34 35 36 37
0000000035 15 AB3465fdsw 35 36 37 38
0000000036 16 AA9asdffds 36 37 38 39
0000000037 17 AA6asdffds 37 38 39 40
0000000038 18 AB3463fdsw 38 39 40 41
0000000039 19 AA7asdffds 39 40 41 42
0000000040 20 AB3464fdsw 40 41 42 43
0000000041 1 AA8asdffds 41 42 43 44
0000000042 2 AB3465fdsw 42 43 44 45
0000000043 3 AA9asdffds 43 44 45 46
0000000044 4 AB3466fdsw 44 45 46 47
0000000045 5 AA10asdffds 45 46 47 48
0000000046 6 AA7asdffds 46 47 48 49
0000000047 7 AB3464fdsw 47 48 49 50
0000000048 8 AA8asdffds 48 49 50 51
0000000049 9 AB3465fdsw 49 50 51 52
0000000050 10 AA9asdffds 50 51 52 53
0000000051 11 AB3466fdsw 51 52 53 54
0000000052 12 AA10asdffds 52 53 54 55
0000000053 13 AB3467fdsw 53 54 55 56
0000000054 14 AA11asdffds 54 55 56 57
0000000055 15 AA8asdffds 55 56 57 58
0000000056 16 AB3465fdsw 56 57 58 59
0000000057 17 AA9asdffds 57 58 59 60
0000000058 18 AB3466fdsw 58 59 60 61
0000000059 19 AA10asdffds 59 60 61 62
0000000060 20 AB3467fdsw 60 61 62 63
0000000061 1 AA11asdffds 61 62 63 64
0000000062 2 AB3468fdsw 62 63 64 65
0000000063 3 AA12asdffds 63 64 65 66
0000000064 4 AA9asdffds 64 65 66 67
0000000065 5 AB3466fdsw 65 66 67 68
0000000066 6 AA10asdffds 66 67 68 69
0000000067 7 AB3467fdsw 67 68 69 70
0000000068 8 AA11asdffds 68 69 70 71
0000000069 9 AB3468fdsw 69 70 71 72
0000000070 10 AA12asdffds 70 71 72 73
0000000071 11 AB3469fdsw 71 72 73 74
0000000072 12 AA13asdffds 72 73 74 75
0000000073 13 AA10asdffds 73 74 75 76
0000000074 14 AB3467fdsw 74 75 76 77
0000000075 15 AA11asdffds 75 76 77 78
0000000076 16 AB3468fdsw 76 77 78 79
0000000077 17 AA12asdffds 77 78 79 80
0000000078 18 AB3469fdsw 78 79 80 81
0000000079 19 AA13asdffds 79 80 81 82
0000000080 20 AB3470fdsw 80 81 82 83
0000000081 1 AA14asdffds 81 82 83 84
0000000082 2 AA11asdffds 82 83 84 85
0000000083 3 AB3468fdsw 83 84 85 86
0000000084 4 AA12asdffds 84 85 86 87
0000000085 5 AB3469fdsw 85 86 87 88
0000000086 6 AA13asdffds 86 87 88 89
0000000087 7 AB3470fdsw 87 88 89 90
0000000088 8 AA14asdffds 88 89 90 91
0000000089 9 AB3471fdsw 89 90 91 92
0000000090 10 AA15asdffds 90 91 92 93
0000000091 11 AA12asdffds 91 92 93 94
0000000092 12 AB3469fdsw 92 93 94 95
0000000093 13 AA13asdffds 93 94 95 96
0000000094 14 AB3470fdsw 94 95 96 97
0000000095 15 AA14asdffds 95 96 97 98
0000000096 16 AB3471fdsw 96 97 98 99
0000000097 17 AA15asdffds 97 98 99 100
0000000098 18 AB3472fdsw 98 99 100 1
0000000099 19 AA16asdffds 99 100 1 2
0000000100 20 AA13asdffds 100 1 2 3
0000000001 1 AA2asdffds 1 2 3 4
0000000002 2 AB3459fdsw 2 3 4 5
0000000003 3 AA3asdffds 3 4 5 6
0000000004 4 AB3460fdsw 4 5 6 7
0000000005 5 AA4asdffds 5 6 7 8
0000000006 6 AB3461fdsw 6 7 8 9
0000000007 7 AA5asdffds 7 8 9 10
0000000008 8 AB3462fdsw 8 9 10 11
0000000009 9 AA6asdffds 9 10 11 12
0000000010 10 AA3asdffds 10 11 12 13
0000000011 11 AB3460fdsw 11 12 13 14
0000000012 12 AA4asdffds 12 13 14 15
0000000013 13 AB3461fdsw 13 14 15 16
0000000014 14 AA5asdffds 14 15 16 17
0000000015 15 AB3462fdsw 15 16 17 18
0000000016 16 AA6asdffds 16 17 18 19
0000000017 17 AB3463fdsw 17 18 19 20
0000000018 18 AA7asdffds 18 19 20 21
0000000019 19 AA4asdffds 19 20 21 22
0000000020 20 AB3461fdsw 20 21 22 23
0000000021 1 AA5asdffds 21 22 23 24
0000000022 2 AB3462fdsw 22 23 24 25
0000000023 3 AA6asdffds 23 24 25 26
0000000024 4 AB3463fdsw 24 25 26 27
0000000025 5 AA7asdffds 25 26 27 28
0000000026 6 AB3464fdsw 26 27 28 29
0000000027 7 AA8asdffds 27 28 29 30
0000000028 8 AA5asdffds 28 29 30 31
0000000029 9 AB3462fdsw 29 30 31 32
0000000030 10 AA6asdffds 30 31 32 33
0000000031 11 AB3463fdsw 31 32 33 34
0000000032 12 AA7asdffds 32 33 34 35
0000000033 13 AB3464fdsw 33 34 35 36
0000000034 14 AA8asdffds 34 35 36 37
0000000035 15 AB3465fdsw 35 36 37 38
0000000036 16 AA9asdffds 36 37 38 39
0000000037 17 AA6asdffds 37 38 39 40
0000000038 18 AB3463fdsw 38 39 40 41
0000000039 19 AA7asdffds 39 40 41 42
0000000040 20 AB3464fdsw 40 41 42 43
0000000041 1 AA8asdffds 41 42 43 44
0000000042 2 AB3465fdsw 42 43 44 45
0000000043 3 AA9asdffds 43 44 45 46
0000000044 4 AB3466fdsw 44 45 46 47
0000000045 5 AA10asdffds 45 46 47 48
0000000046 6 AA7asdffds 46 47 48 49
0000000047 7 AB3464fdsw 47 48 49 50
0000000048 8 AA8asdffds 48 49 50 51
0000000049 9 AB3465fdsw 49 50 51 52
0000000050 10 AA9asdffds 50 51 52 53
0000000051 11 AB3466fdsw 51 52 53 54
0000000052 12 AA10asdffds 52 53 54 55
0000000053 13 AB3467fdsw 53 54 55 56
0000000054 14 AA11asdffds 54 55 56 57
0000000055 15 AA8asdffds 55 56 57 58
0000000056 16 AB3465fdsw 56 57 58 59
0000000057 17 AA9asdffds 57 58 59 60
0000000058 18 AB3466fdsw 58 59 60 61
0000000059 19 AA10asdffds 59 60 61 62
0000000060 20 AB3467fdsw 60 61 62 63
0000000061 1 AA11asdffds 61 62 63 64
0000000062 2 AB3468fdsw 62 63 64 65
0000000063 3 AA12asdffds 63 64 65 66
0000000064 4 AA9asdffds 64 65 66 67
0000000065 5 AB3466fdsw 65 66 67 68
0000000066 6 AA10asdffds 66 67 68 69
0000000067 7 AB3467fdsw 67 68 69 70
0000000068 8 AA11asdffds 68 69 70 71
0000000069 9 AB3468fdsw 69 70 71 72
0000000070 10 AA12asdffds 70 71 72 73
0000000071 11 AB3469fdsw 71 72 73 74
0000000072 12 AA13asdffds 72 73 74 75
0000000073 13 AA10asdffds 73 74 75 76
0000000074 14 AB3467fdsw 74 75 76 77
0000000075 15 AA11asdffds 75 76 77 78
0000000076 16 AB3468fdsw 76 77 78 79
0000000077 17 AA12asdffds 77 78 79 80
0000000078 18 AB3469fdsw 78 79 80 81
0000000079 19 AA13asdffds 79 80 81 82
0000000080 20 AB3470fdsw 80 81 82 83
0000000081 1 AA14asdffds 81 82 83 84
0000000082 2 AA11asdffds 82 83 84 85
0000000083 3 AB3468fdsw 83 84 85 86
0000000084 4 AA12asdffds 84 85 86 87
0000000085 5 AB3469fdsw 85 86 87 88
0000000086 6 AA13asdffds 86 87 88 89
0000000087 7 AB3470fdsw 87 88 89 90
0000000088 8 AA14asdffds 88 89 90 91
0000000089 9 AB3471fdsw 89 90 91 92
0000000090 10 AA15asdffds 90 91 92 93
0000000091 11 AA12asdffds 91 92 93 94
0000000092 12 AB3469fdsw 92 93 94 95
0000000093 13 AA13asdffds 93 94 95 96
0000000094 14 AB3470fdsw 94 95 96 97
0000000095 15 AA14asdffds 95 96 97 98
0000000096 16 AB3471fdsw 96 97 98 99
0000000097 17 AA15asdffds 97 98 99 100
0000000098 18 AB3472fdsw 98 99 100 1
0000000099 19 AA16asdffds 99 100 1 2
0000000100 20 AA13asdffds 100 1 2 3
0
5
0
0


ESP32学习笔记03-日志打印 日志分为5个等级。 阅读详情

相关推荐

python使用TensorRT报错,多线程或多进程中使用问题

python使用TensorRT报错,Cuda Runtime问题

qq_44224801的博客 756

算法竞赛入门经典(第二版)-刘汝佳-第四章 函数与递归 师兄帮帮忙

http://acm.hust.edu.cn/vjudge/contest/123676#problem/F 密码 5201 #include #include #include #include using namespace std; const double EPS = 1e-5; int len=0; struct studen

bushadid的博客 585

setup time和hold time的计算

内容仅仅为了方便记忆,与原理无关

sddhyl的博客 7830

uva 12412

无聊水题,代码没A,找不到BUG 不改了 #include <iostream> #include <cstdio> #include <cstring> #include <map> #include <string> #include <algorithm> using namespace std; const do...

weixin_43763889的博客 231

MWORKS赋能蓝桥杯智能装备数字化建模大赛:技术解析与实战指南

本文深入解析了如何利用MWORKS平台参加蓝桥杯智能装备数字化建模大赛。文章从认识MWORKS这一多领域统一建模仿真平台入手,详细阐述了构建包含控制算法与数字样机的动态系统模型的核心方法,并提供了从软件入门、分层建模到作品打磨的完整实战指南,助力参赛者掌握智能装备数字化设计的关键技能。

weixin_29279101的博客 388

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

基于TL431与MOSFET的高效过压保护电路设计详解

本文详细解析了基于TL431与MOSFET的高效过压保护电路设计。通过TL431精准监测电压,驱动MOSFET作为主开关,实现快速可靠的电源保护。文章涵盖电路原理、参数计算、性能优化及实战调试要点,为电子设备提供了一套经典且成本低廉的过压保护解决方案。

weixin_29215391的博客 803

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

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

changing___的博客 933

MATLAB基础应用精讲-【深度强化学习】SAC(Soft Actor-Critic)算法(附MATLAB和python代码实现)

Actor 网络:用于选择动作。Critic 1 和 Critic 2 网络:用于估计 Q 值。Target Critic 1 和 Target Critic 2:与 Critic 网络架构相同,用于生成更稳定的目标 Q 值。,即在保证探索的情况下选择高价值动作。软更新目标 Q 网络参数,使得目标网络参数缓慢向当前网络靠近,避免振荡。

qq_36130719的博客 460

ESP32S3 TLS 握手WIFI可用但是在蜂窝热点下卡死:排查方法与根因

设备卡在等。

摸鱼专家 97

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

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

努力做个书呆儿 515

电气:蒙特卡洛1000个风光场景并通过削减法|聚类法得到几个典型场景(matlab\python实现)

    个人电气目录传送门:学好电气全靠它,个人电气博文目录(持续更新中…)     本文内容包括22页(代码和一些自己对风光的观点) 提示:专栏解锁后,可以查看该专栏所有文章,划算。 文章目录一、理论依据1.风电DG出力概率模型1.2光伏DG出力概率模型1.3对风光的认识二、蒙特卡洛模拟1000个风光场景、并通过削减法得到5个典型风电场景 (Matlab 版程序)三、蒙特卡洛模拟1000个风光场景、并通过聚类法得到5个典型

总裁余(余登武)博客 7684

算法竞赛入门经典(第二版)-刘汝佳-第四章 函数与递归 师兄帮帮忙 Uva12412

A Typical Homework(a.k.a Shi Xiong Bang Bang Mang) Hi, I am an undergraduate student in institute of foreign languages. As you know, C programming is a required course in our university, even if hi

h1120023921的博客 1098

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

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

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

例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

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

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

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

qq_33942309的博客 253

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

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

【例题4-6 uva12412】A Typical Homework (a.k.a Shi Xiong Bang Bang Mang)

【链接】 我是链接,点我呀:) 【题意】 在这里输入题意 【题解】 训练编程的题。 原题中没有除0的数据,所以别担心你的代码是因为除0错了。 多半跟我一样。 也是因为没有+eps 就是比如你要算tot/4的值。 那么要输出tot/4+1e-6 不然会错。。。 浮点误差... 剩下的。其实很简答的。。 注意有并列第x的情况就好。 【代码】 #include <bi...

180

UVA12412

这道题目不难,只是处理的过程有一些复杂,比如: 如何实现同时搜索sid和name 如何表示rank?是每次一添加student就刷新rank还是查询的时候才计算rank, 这个问题就是如何查询student的的次数多还是总的student的人数之间的博弈,一般倾向于在查询的时候才计算rank 如何实现按输入进数据库的顺序输出学生的情况。汝佳大神的思路是直接使用数组,来表示学生,直接...

212

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

A Typical Homework (a.k.a Shi Xiong Bang Bang Mang)  UVA - 12412  题目传送门 emmmm,不想表达什么,udbug上的数据全过,可就是WA。。。。 AC了的代码(大佬的代码) #include &lt;bits/stdc++.h&gt; using namespace std; const string subject...

C++的星空 450

例题4-6 师兄帮帮忙 UVa12412

例题4-6 师兄帮帮忙 UVa12412 感悟。 1、阅读书中题目,从网站下载英文原题,重点在看输出数据与格式。 2、开始编码,先搭函数框架,具体功能实现,待主体框架打好后,再进行。 3、程序测试比较繁琐,有较多的输出输出,有些接近现实的应用程序了。 4、add功能还算顺利,数据采用结构体数组的方式存储。 5、query功能,发现要添加要在结构体中继续添加一些数据,还需在add功能

mrcrack的博客 2368

师兄帮帮忙(A Typical Homework,ACM)

#include #include #include using namespace std; const double EPS = 1e-5; //精确度 const int maxn = 1024; int cnt = 0; struct stu{ string SID, name; int CID; int score[5]; bool removed; }all[maxn];//数组最多可

liang_1996的博客 648

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

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 (a.k.a Shi Xiong Bang Bang Mang) UVA - 12412

题目链接:https://vjudge.net/problem/UVA-12412 典型的先写框架,在补写函数的“作业题”。 但有两点要注意: 1.当数据库为0时,要Show Statistics 时,输出的平均分为0.00 2.在使用浮点型时要注意控制精度 1e-6 代码: #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &...

qq_43185391的博客 246

hdu 4506 小明系列故事——师兄帮帮忙

小明系列故事——师兄帮帮忙 Time Limit : 3000/1000ms (Java/Other)   Memory Limit : 65535/32768K (Java/Other) Total Submission(s) : 22   Accepted Submission(s) : 4 Problem Description   小明自从告别了ACM/ICPC之后,就开始潜心研究...

小子有一剑的博客 297
上一篇: 算法竞赛入门经典(第2版)习题3-12 浮点数 Floating-Point Numbers UVa11809
下一篇: 算法竞赛入门经典(第2版)习题4-1 象棋 Xiangqi UVa1589
_Arc
博客等级 码龄26年 47粉丝 35原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值