refactor: 移动并重写P8866.cpp文件

将P8866.cpp从src/8/12目录移动到src/9/29目录
重写文件内容,添加完整逻辑处理输入输出
This commit is contained in:
Zengtudor 2025-09-30 16:33:14 +08:00
parent 0cea6a732c
commit 250e0ca930
2 changed files with 42 additions and 3 deletions

View File

@ -1,3 +0,0 @@
int main(){
}

42
src/9/29/P8866.cpp Normal file
View File

@ -0,0 +1,42 @@
#include <cstdint>
#include <iostream>
using ll = int64_t;
ll T,n,m,k,kp;
int main(){
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cin>>T;
while(T--){
std::cin>>n>>m>>k;
bool isn2n=false;
ll n2n=0;
for(ll i=1;i<=m;i++){
std::cin>>kp;
nxt:;
if(isn2n && kp!=2*n-1){
if((n2n&1)==0){
for(ll j=1;j<=n2n;j++){
std::cout<<1<<" "<<n<<"\n";
goto nxt;
}
}else{
if((kp&1)==0){
for(ll j=1;j<=n2n;j++){
std::cout<<1<<" "<<((kp+1)>>2)<<"\n";
}
std::cout;
}
}
isn2n=false;
n2n=0;
}else if(kp==2*n-1){
n2n++;
isn2n=true;
}
}
}
}