文章

77

粉丝

19

获赞

388

访问

48.8k

头像
输出柱状图 题解:
P1969 四川大学2024年机试题
发布于2025年8月31日 17:33
阅读数 23

#include<bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin >> n;
    int max = 0;
    int nums[n];
    for (int i = 0; i < n; i++) {
        //TODO
        cin >> nums[i];
        if (nums[i] > max) {
            max = nums[i];
        }
    }
    while (max) {
        for (int i = 0; i < n; i++) {
            if (nums[i] >= max) {
                cout << "*" << " ";
            } else {
            ...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发