• 个人简介

    安琪拉

    别点开

    帅帅帅

    腾讯视频

    听说是MC

    #include<bits/stdc++.h> using namespace std; int a, b, c, d, e, l; struct node{ int cnt; string s; } p[40]; bool cmp ( node x, node y ){ if ( x.cnt==y.cnt ){ string xx = x.s; string yy = y.s; if ( xx[0]==yy[0] ){ if ( xx[1]==yy[1] ){ if ( xx[2]==yy[2] ){ if ( xx[3]==yy[3] ) return xx[4] < yy[4]; return xx[3] - '0' < yy[3] - '0'; } return xx[2] - '0' < yy[2] - '0'; } return xx[1] - '0' < yy[1] - '0'; } return xx[0] - '0' < yy[0] - '0'; } return x.cnt > y.cnt; } int main( ){ cin >>a >>b >>c >>d >>e; p[++l].s = "ABCDE"; p[l].cnt = a + b + c + d + e; p[++l].s = "ABCD"; p[l].cnt = a + b + c + d; p[++l].s = "ABDE"; p[l].cnt = a + b + e + d; p[++l].s = "ABCE"; p[l].cnt = a + b + c + e; p[++l].s = "AECD"; p[l].cnt = a + e + c + d; p[++l].s = "BECD"; p[l].cnt = b + e + c + d; p[++l].s = "ABC"; p[l].cnt = a + b + c; p[++l].s = "ABD"; p[l].cnt = a + b + d; p[++l].s = "ABE"; p[l].cnt = a + b + e; p[++l].s = "ACE"; p[l].cnt = a + e + c; p[++l].s = "ACD"; p[l].cnt = a + d + c; p[++l].s = "ADE"; p[l].cnt = a + e + d; p[++l].s = "BCD"; p[l].cnt = a + b + c; p[++l].s = "BCE"; p[l].cnt = a + b + c; p[++l].s = "BDE"; p[l].cnt = a + b + c; p[++l].s = "CDE"; p[l].cnt = e + d + c; p[++l].s = "AB"; p[l].cnt = a + b; p[++l].s = "AC"; p[l].cnt = a + c; p[++l].s = "AD"; p[l].cnt = a + d; p[++l].s = "AE"; p[l].cnt = a + e; p[++l].s = "BC"; p[l].cnt = c + b; p[++l].s = "BD"; p[l].cnt = d + b; p[++l].s = "BE"; p[l].cnt = e + b; p[++l].s = "CD"; p[l].cnt = c + d; p[++l].s = "CE"; p[l].cnt = c + e; p[++l].s = "DE"; p[l].cnt = e + d; p[++l].s = "A"; p[l].cnt = a; p[++l].s = "B"; p[l].cnt = b; p[++l].s = "C"; p[l].cnt = c; p[++l].s = "D"; p[l].cnt = d; p[++l].s = "E"; p[l].cnt = e; sort (p + 1, p + 32, cmp); for ( int i = 1; i<=31; i++ ){ cout <<p[i].s <<"\n"; } return 0; }

  • 通过的题目

  • 最近活动

    This person is lazy and didn't join any contests or homework.
  • 最近编写的题解

    This person is lazy and didn't write any solutions.

题目标签

入门
7
数组下标
5
递推
4
前缀和
2
输入输出
1
动态规划
1
一本通编程启蒙
1