Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
292227 孟梓骞 【C6-7】图书管理员 C++ 通过 100 173 MS 276 KB 467 2024-08-27 19:56:53

Tests(10/10):


#include<bits/stdc++.h> using namespace std; int a[1005],b[1005],c[1005]; bool f; int main(){ int n,m; cin>>n>>m; for(int i=1; i<=n; i++){ cin>>a[i]; } sort(a+1,a+1+n); for(int i=1; i<=m; i++){ cin>>b[i]>>c[i]; } for(int i=1; i<=m; i++){ f=0; for(int j=1; j<=n; j++){ int t=pow(10,b[i]); if(c[i]==a[j]%t){ cout<<a[j]<<endl; f=1; break; } } if(f==0){ cout<<"-1"<<endl; } } return 0; }


测评信息: