第一题:https://codeforces.com/contest/1768/problem/A
#include<iostream>
#include <string.h>
#include<string>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
int main(){
int u;
cin>>u;
while (u--){
long long num;
cin>>num;
bool yes=1;
for(long long i=num-1;i>0;i++){
if(num%(i+1)==0){
cout<<i<<endl;
yes=0;
break;
}
}
if(yes){
cout<<"-1"<<endl;
}
}
return 0;
}
第二题:https://codeforces.com/contest/1768/problem/B
#include<iostream>
#include <string.h>
#include<string>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
int main(){
int u;
cin>>u;
while (u--){
int le,num;
cin>>le>>num;
int arr[le];
int sum=0;
int t=0;
for(int i=0;i<le;i++){
cin>>arr[i];
if(arr[i]==t+1){
t++;
}
}
int ui=le-t;
int y=(ui)/num;
if(ui%num&&(le-t)){
y++;
}
//int ui=t/num;
cout<<y<<endl;
}
return 0;
}
//济几吓济几
标签:le,int,每日,cin,long,num,include
From: https://www.cnblogs.com/shenqimaomaoxia/p/18603737