acgo题库
  • 首页
  • 题库
  • 学习
  • 竞赛
  • 讨论
  • 排行
  • 团队
  • 备赛专区

    竞赛

    • CSP-J/S
    • 蓝桥杯
    • CSP - J/S 估分

    考级

    • GESP
    • CPA
    • 电子学会考级
登录
注册
题目详情提交记录(0)
  • 结构体的运用

    userId_undefined

    回来看看

    出道萌新倔强青铜
    51阅读
    2回复
    1点赞
  • struct utilization

    #include <iostream> #include <vector> #include <algorithm> using namespace std; // 定义一个结构体来存储玩家信息 struct Player { int index; // 玩家序号 int oneStar; // 1星英雄数量 int twoStar; // 2星英雄数量 int threeStar; // 3星英雄数量 int strength; // 阵容强度 }; // 计算阵容强度 int calculateStrength(int oneStar, int twoStar, int threeStar) { return oneStar + twoStar * 3 + threeStar * 9; } // 按照阵容强度排序的比较函数 bool comparePlayers(const Player &a, const Player &b) { if (a.strength != b.strength) { return a.strength > b.strength; // 强度大的在前 } else { return a.index < b.index; // 强度相同,序号小的在前 } } int main() { int n; cin >> n; }

    userId_undefined

    AC狗 ( ̄3 ̄)

    数组·数组操作员I/O·IO入门者循环·循环打卡人模拟·模拟练习生
    31阅读
    0回复
    0点赞
  • 谁说得用长代码!!!

    #include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; vector<pair<int,int>>p(n); for(int i=0; i<n; ++i) { int a,b,c; cin>>a>>b>>c; p[i]={-(a+3b+9c),i+1}; } sort(p.begin(),p.end()); for(auto& p:p)cout<<p.second<<" "; }//简简单单~~

    userId_undefined

    黑客

    4阅读
    0回复
    1点赞
暂无数据

提交答案之后,这里将显示提交结果~

首页