A - Chrome Tabs
Gym - 101608A
代码语言:javascript复制&:之所以整理是因为自己傻到WA了好多次。
#include <bits/stdc .h>
using namespace std;
typedef long long ll;
int main()
{
int t;
int k,n;
freopen("tabs.in","r",stdin);
scanf("%d", &t);
while(t--)
{
scanf("%d %d", &n, &k);
if(n == 1) printf("0n"); //0 的时候没有
else if(k == 1) printf("1n"); // 两种端点情况
else if(n == k) printf("1n");
else
{
printf("2n"); // 其余
}
}
return 0;
}
B - OverCode
Gym - 101608B
代码语言:javascript复制#include <bits/stdc .h>
using namespace std;
typedef long long ll;
int a[560];
int main()
{
int t;
int k,n;
freopen("overcode.in","r",stdin);
scanf("%d", &t);
while(t--)
{
scanf("%d", &n);
for(int i = 0; i < n; i )
{
scanf("%d", &a[i]);
}
sort(a,a n);
int res = 0;
for(int i = 0; i < n;)
{
if(i 5 < n) {
if(abs(a[i] - a[i 5]) <= 1000) {res ;
i = 6;}
else i ;
}
else break;
}
printf("%dn",res);
}
return 0;
}
C - A message for you!
Gym - 101608C
代码语言:javascript复制#include <bits/stdc .h>
using namespace std;
typedef long long ll;
char s[20];
int a[50];
int vis[50];
int main()
{
int t;
int n;
freopen("scoreboard.in","r",stdin);
scanf("%d", &t);
while(t--)
{
scanf("%dn", &n);
memset(vis,0,sizeof(vis));
scanf("%s", s);
for(int i = 0; i < n; i )
{
vis[s[i] - 'A' 1] ;
}
int Max = -1;
int res = 0;
for(int i = 1; i <= 13 ; i )
{
scanf("%d", &a[i]);
if(!vis[i]){
if(Max < a[i]){
Max = a[i];
res = i;
}
}
}
printf("%cn", res 'A' - 1);
}
return 0;
}