Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
3299 孙浚轩 长方形排序 C++ Compile Error 0 MS 0 KB 656 2024-05-04 21:02:29

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; struct rectangle{ int id,lenth,width; void input(){ cin>>id>>lenth>>width; }void output(){ cout<<id<<" "<<lenth<<" "<<width<<endl; } }rec[1000]; bool cmp(rectangle a,rectangle b){ if(a.id!=b.id) return a.id<b.id; else if(a.lenth!=b.lenth) return a.lenth<b.lenth; else return a.width<b.width; } int main(){ int n; cin>>n; for(int i=0;i<n;i++) rec[i].input(); sort(fri,fri+n,cmp); for(int i=0;i<n;i++) if(rec[i-1].id!=rec[i].id||rec[i-1].lenth!=rec[i].lenth||rec[i-1].width!=rec[i].width) rec[i].output(); return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:23:10: error: 'fri' was not declared in this scope
     sort(fri,fri+n,cmp);
          ^