牛牛玩平板(老眼昏花第一反应居然都按照乘法)

牛牛玩平板

https://ac.nowcoder.com/acm/problem/21841

//其实我觉得不用排序也可以,毕竟每一个的贡献都是那些,不会因为顺序导致,但是不排序可能就偏离题解毕竟是贪心(个人看法)

#include<cstdio>
const int maxn = 110;
int main(){
    int list[maxn];
    int n;
    scanf("%d", &n);
    for(int i = 0; i < n; i++){
        scanf("%d", &list[i]);
    }
    int score = 0;
    for(int i = 0; i < n-1; i++){
        int temp = list[i] * list[i+1];
        score += temp;
        list[i+1] = list[i] + list[i+1];
    }
    printf("%d\n", score);
    return 0;
}
全部评论

相关推荐

nus2201602...:兄弟,你这个简历撕了丢了吧,就是一坨,去找几个项目,理解项目流程,看几遍就是你的了,看看八股就去干了,多看看牛客里别人发出来的简历,对着写,你这写的啥啊,纯一坨
点赞 评论 收藏
分享
评论
3
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务