Papyrus在审判你 • 1年前
#include<bits/stdc++.h>
using namespace std;
int main(){
int a[5][5]={0};
a[0][1]=5;
a[0][2]=1;
a[1][2]=3;
a[2][4]=4;
a[2][3]=8;
a[3][2]=2;
for(int i=0;i<5;i++){
for(int j=0;j<5;j++){
cout<<a[i][j]<<" ";
}
cout<<endl;
}
return 0;
}
评论:
using namespace std; int a[MAXN]; int main(){ int i,j,n,k,first = 1; memset(a,0,sizeof(a)); cin>>n>>k; for(i=1;i<=k;i++) for(j=1;j<=n;j++)
if(j%i==0) a[j]=!a[j];
for(i=1;i<=n;i++) if(a[i]) {
if(first) first =0; else cout<<" ";
cout<<i; }
cout<<endl;
return 0;
}
using namespace std;
int main() {
int n;
cin >> n;
int a[10010] = {}, b[10010] = {}, g[10010] = {}, k[10010] = {};
for (int i = 1; i <= n; i++) {
cin >> a[i] >> b[i] >> g[i] >> k[i];
}
int x, y;
bool t = 0;
cin >> x >> y;
for (int i = n; i >= 1; i--) {
if (x >= a[i] && x <= g[i] + a[i] && y >= b[i] && y <= k[i] + b[i]) {
cout << i;
t = 1;
break;
}
}
if (!t) {
cout << -1;
}
return 0;
}
请先登录,才能进行评论