634div3

弱鸡只会四题
A

#include <bits/stdc++.h>
using namespace std;
int a[100005],b[100005];
int main ()
{
 ios::sync_with_stdio(false);
 int T;
 cin>>T;
 while(T--)
 {
  int n;
  cin>>n;
  cout<<(n-1)/2<<endl; 
 }
 return 0;
}

B

#include <bits/stdc++.h>
using namespace std;
int a[100005],b[100005];
int main ()
{
 ios::sync_with_stdio(false);
 int T;
 cin>>T;
 while(T--)
 {
  int n,a,b;
  cin>>n>>a>>b;
  for(int i=1; i<=n; i++)
  {
   char c='a'+i%b;
   cout<<c;
  }
  cout<<endl;
 }
 return 0;
}

c

#include <bits/stdc++.h>
using namespace std;
map<int,int> m;
int main ()
{
 ios::sync_with_stdio(false);
 int T;
 cin>>T;
 while(T--)
 {
  m.clear();
  int n,t,c=0,s=0;
  cin>>n;
  for(int i=0; i<n; i++)
  {
   cin>>t;
   if(!m[t]) c++;
   m[t]++;
   if(m[t]>s) s=m[t];
  }
  if(s>c) cout<<c<<endl;
  else if(s==c) cout<<c-1<<endl;
  else cout<<s<<endl;
 }
 return 0;
}

D

#include <bits/stdc++.h>
using namespace std;
char a[10][10];
int main ()
{
 ios::sync_with_stdio(false);
 int T;
 cin>>T;
 while(T--)
 {
  for(int i=0; i<9; i++)
  {
   for(int j=0; j<9; j++)
   cin>>a[i][j];
  }
  for(int i=0; i<3; i++)
  {
   for(int j=0; j<3; j++)
   {
    if(a[i*3+j][j*3+i]=='1') a[i*3+j][j*3+i]='2';
    else a[i*3+j][j*3+i]='1';
   }
  }
  for(int i=0; i<9; i++)
  {
   for(int j=0; j<9; j++)
   cout<<a[i][j];
   cout<<endl;
  }
 }
 return 0;
}
发布了5 篇原创文章 · 获赞 10 · 访问量 125

猜你喜欢

转载自blog.csdn.net/Federal_ding/article/details/105500904