Java编程

牛客网华为笔试题测试工程师

N 1000){ cout “[]” endl; } else{ int count=0; while(r1 =r2&&c1 =c2){ for(int i=c1;i =c2;++i){ count++; if((count%10)==7&&(count/10)%2==1){ nums.push_back({r1,i}); } } for(int j=r1+1;j =r2;++j){ count++; if((count%10)==7&&(count/10)%2==1){ nums.push_back({j,c2}); } } if(r1 r2&&c1 c2){ for(int i=c2-1;i =c1;–i){ count++; if((count%10)==7&&(count/10)%2==1){ nums.push_back({r2,i}); } } for(int j=r2-1;j r1;–j){ count++; if((count%10)==7&&(count/10)%2==1){ nums.push_back({j,c1}); } } } r1++;r2–;c1++;c2–; } cout ‘[‘; for(size_t i=0;i nums.size();++i){ cout ‘[‘ nums[i].first ‘,’ nums[i].second ‘]’; if(i!=nums.size()-1){ cout ‘,’; } } cout ‘]’ endl; } return 0;}

Similar Posts

发表评论

邮箱地址不会被公开。 必填项已用*标注