_Phoebe__ 2022-01-31 14:32 采纳率: 96.9%
浏览 17
已结题

我写的这个代码 样例输入中有几行输入不进去 想知道怎么改

样例:
4 4
501 502 503 504
2 3 5 7
50 30 10 5 93 50 1
10
501 2 10
501 2 80//好像从这里输入不了了
501 2 70
502 3 0
502 3 0
504 5 100
503 7 0
503 7 0
503 7 0
503 7 10
输出

480
372
Use Luogu!


#include<bits/stdc++.h>
using namespace std;
int n,m,ta,tb,tc,td,A,H,E,r;
int p[1024],s[1024],score[1024][1024],judge[1024][1024];//评测次数 
int teacher,stu;
int pr,sr,sc,luogu,tra;
int main(){
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        cin>>p[i];
    }
    for(int i=1;i<=m;i++){
        cin>>s[i];
    }
    sort(p+1,p+n+1);
    sort(s+1,s+n+1);
    cin>>ta>>tb>>tc>>A>>H>>E;
    cin>>r;
    tra=ta*n;
    for(int i=1;i<=r;i++){
        cin>>pr>>sr>>sc;
        pr=lower_bound(p+1,p+n+1,pr)-p;
        sr=lower_bound(s+1,s+n+1,sr)-p;
        if(sc>score[sr][pr]&&E==1){//excel更改 
            tra+=td;
            score[sr][pr]=sc;
        }
            judge[sr][pr]++; 
        
    }
    luogu=(n*ta+r*tc)*100/A+H;
    for(int i=1;i<=m;i++){
        for(int j=1;j<=n;j++){
            teacher=0,stu=ta;
            teacher+=tb*judge[i][j];
            stu+=tc*judge[i][j];
            tra+=min(teacher,stu);
        }
    }
    cout<<tra<<endl<<luogu<<endl;
    if(luogu<tra){
        cout<<"Use Luogu!"; 
    }
    else
    cout<<"Forget it...";
    return 0;
}
 
  • 写回答

1条回答 默认 最新

  • cab_bage 2022-01-31 15:41
    关注

    循环的问题

    img

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 2月9日
  • 已采纳回答 2月1日
  • 创建了问题 1月31日

悬赏问题

  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥170 如图所示配置eNSP
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果