事先声明
我划水了
没写几个
都在这了QWQ
A
/* Author: 张皓南 Result: AC Submission_id: 2594720 Created at: Fri May 08 2020 20:55:50 GMT+0800 (China Standard Time) Problem_id: 3375 Time: 3 Memory: 1708 */
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <ctype.h>
int m, x, y, i, j;
char a[50][55];
int main(){
scanf("%d",&m);
scanf("%d%d",&x,&y);
for (i=0;i<=m;i++) gets(a[i]);
printf("%c\n",a[x][y-1]);
j=y-1;
while(1){
if (j==strlen(a[x])) return 0;
printf("%c", a[x][j]);
j++;
}
return 0;
}
B
/* Author: 张皓南 Result: AC Submission_id: 2594594 Created at: Fri May 08 2020 20:53:49 GMT+0800 (China Standard Time) Problem_id: 3382 Time: 5 Memory: 1740 */
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <ctype.h>
int m, n, i, j, k, l, f;
char a[111][111];
int main(){
scanf("%d%d", &m, &n);
for (i = 0; i < m; i++) scanf("%s", &a[i]);
scanf("%d%d", &k, &l);
printf("%s\n",a[k-1]);
j=(l-1)%n;
for (i=(l-1)/n;i<m;i++){
if(f)j = 0;
for (j;j<n;j++){
f = 1;
printf("%c", a[i][j]);
}
}
return 0;
}
C
/* Author: 张皓南 Result: AC Submission_id: 2594892 Created at: Fri May 08 2020 20:58:55 GMT+0800 (China Standard Time) Problem_id: 3133 Time: 7 Memory: 1708 */
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <ctype.h>
struct zhn{
char xm[20];
long long xh;
} a[1000];
int n, m, i,flag;
long long j, pyc;
int main(){
scanf("%d%d", &n, &m);
for (i = 1; i <= n; i++){
scanf("%s", &a[i].xm);
scanf("%lld", &a[i].xh);
}
j=1;
flag=0;
for (i=1;i<=n;i++){
if(flag==0){
scanf("%lld", &pyc);
flag=1;
}
if(a[i].xh!=pyc){
printf("%s\n",a[i].xm);
}
else{
flag=0;
}
}
return 0;
}
D
#include <stdio.h>
#include <math.h>
#include <string.h>
#define int long long
int n,i,m,t,j,k,tt;
int flag;
int a[56];
int arr[56];
int zhn[45];
int tmp[50];
main(){
scanf("%lld%lld%lld",&n,&m,&tt);
flag=0;
for(i=0;i<n;i++) scanf("%lld",&zhn[i]),a[i]=i+1;
for(j=m;a[0]<=(n-m+1);){
for(;a[m-1]<=n;a[m-1]++){
int tmp=0;
for(t=0;t<m;t++){
tmp+=zhn[a[t]-1];
}
if(tmp>=tt){
flag=1;
for(t=0;t<m;t++){
printf("%lld ",a[t]);
}
printf("\n");
}
}
for(j=m-2;j>=0;j--){
a[j]++;
if(a[j]<=(j+n-m+1)){
break;
}
}
for(j++;j>0&&j<m;j++)a[j]=a[j-1]+1;
}
if(!flag) printf("Sorry, teacher.");
return 0;
}
E
/* Author: 张皓南 Result: AC Submission_id: 2594359 Created at: Fri May 08 2020 20:49:37 GMT+0800 (China Standard Time) Problem_id: 3380 Time: 8 Memory: 1708 */
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <ctype.h>
char yue[10];
int ri, nian;
int month;
int f,i,j,ans;
int ts[]={
0,31,28,31,30,31,30,31,31,30,31,30,31};
int main(){
scanf("%s", &yue);
scanf("%d%d", &ri, &nian);
if (yue[0]=='J'){
if (yue[1]=='a') month=1;
else if (yue[2] == 'n') month = 6;
else month = 7;
}
else if (yue[0] == 'F') month = 2;
else if (yue[0] == 'M'){
if (yue[2] == 'r') month = 3;
else month = 5;
}
else if (yue[0] == 'A')
{
if (yue[1] == 'p') month = 4;
else month = 8;
}
else if (yue[0] == 'S')month = 9;
else if (yue[0] == 'O') month = 10;
else if (yue[0] == 'N')month = 11;
else if (yue[0] == 'D')month = 12;
if(nian%400==0){
f=1;
}
else if(nian%4==0&&nian%100!=0){
f=1;
}
if(f){
ts[2]=29;
}
for(i=1;i<month;i++){
ans+=ts[i];
}
ans+=ri;
printf("%d ",365+f-ans);
if(ri>13){
printf("%d",12-month);
}else{
printf("%d",13-month);
}
return 0;
}
F
/* Author: 张皓南 Result: AC Submission_id: 2592468 Created at: Fri May 08 2020 20:11:36 GMT+0800 (China Standard Time) Problem_id: 3379 Time: 161 Memory: 6196 */
#include <stdio.h>
#include <math.h>
#include <string.h>
int n,i;
int x,y;
struct NODE{
int id;
char z;
char x;
int zhi;
}zhn[200005];
int cmp( const void *a ,const void *b) {
return (*(struct NODE *)a).id > (*(struct NODE *)b).id;
}
int main(){
scanf("%d",&n);
for(i=0;i<n;i++) scanf("%d %c%c%d",&zhn[i].id,&zhn[i].z,&zhn[i].x,&zhn[i].zhi);
qsort(zhn,n,sizeof(zhn[0]),cmp);
x=0,y=0;
for(i=0;i<n;i++){
if(zhn[i].z=='X'){
if(zhn[i].x=='='){
x=zhn[i].zhi;
}
else if(zhn[i].x=='+'){
x+=zhn[i].zhi;
}
else if(zhn[i].x=='-'){
x-=zhn[i].zhi;
}
else if(zhn[i].x=='*'){
x=x*zhn[i].zhi;
}
else if(zhn[i].x=='/'){
x=x/zhn[i].zhi;
}
}
else if(zhn[i].z=='Y'){
if(zhn[i].x=='='){
y=zhn[i].zhi;
}
else if(zhn[i].x=='+'){
y+=zhn[i].zhi;
}
else if(zhn[i].x=='-'){
y-=zhn[i].zhi;
}
else if(zhn[i].x=='*'){
y=y*zhn[i].zhi;
}
else if(zhn[i].x=='/'){
y=y/zhn[i].zhi;
}
}
}
printf("%d %d",x,y);
return 0;
}
G
/* Author: 张皓南 Result: AC Submission_id: 2591434 Created at: Fri May 08 2020 19:53:04 GMT+0800 (China Standard Time) Problem_id: 3377 Time: 6 Memory: 2228 */
#include <stdio.h>
#include <math.h>
#include <string.h>
const int maxn=100+5;
char pic[105][105];
int idx[105][105];
int m,n;
void dfs(int r,int c,int id)
{
if(r<0||r>=m||c<0||c>=n)return;
if(idx[r][c]>0||pic[r][c]!='W')return;
idx[r][c]=id;
for(int i=-1; i<=1; i++)
for(int j=-1; j<=1; j++)
{
if(i!=0||j!=0)
dfs(r+i,c+j,id);
}
}
int main()
{
int cnt=0;
memset(idx,0,sizeof(idx));
scanf("%d%d",&m,&n);
for(int i=0;i<m;i++) scanf("%s",pic[i]);
for(int i=0; i<m; i++)
for(int j=0; j<n; j++)
{
if(pic[i][j]=='W'&&idx[i][j]==0)
dfs(i,j,++cnt);
}
printf("%d",cnt);
return 0;
}
I
/* Author: 张皓南 Result: AC Submission_id: 2601371 Created at: Sun May 10 2020 21:56:43 GMT+0800 (China Standard Time) Problem_id: 3372 Time: 208 Memory: 4064 */
#include <stdio.h>
#include <math.h>
#include <string.h>
int i,m,n,a[200005],b[200005];
int ans[200005];
int zhn,lgr,qzp;
int main(){
while(scanf("%d%d",&m,&n)==2){
memset(a,0,sizeof(a));
memset(b,0,sizeof(b));
for(i=1;i<=m;i++) scanf("%d",&a[i]);
for(i=1;i<=n;i++) scanf("%d",&b[i]);
zhn=1,lgr=1,qzp=0;
while(zhn<=m&&lgr<=n){
if(a[zhn]>=b[lgr]){
++qzp;
ans[qzp]=b[lgr];
lgr++;
}
else if(a[zhn]<=b[lgr]){
++qzp;
ans[qzp]=a[zhn];
zhn++;
}
}
if(zhn>m)for(i=lgr;i<=n;i++) ans[++qzp]=b[i];
else if(lgr>n)for(i=zhn;i<=m;i++) ans[++qzp]=a[i];
if((n+m)&1)printf("%.1lf\n",(double)(ans[(qzp+1)/2]));
else if((n+m)%2==0){
double a1=ans[(n+m)/2]*1.0;
double a2=ans[(n+m)/2+1]*1.0;
printf("%.1lf\n",(a1+a2)/2);
}
}
return 0;
}
k
/* Author: 张皓南 Result: AC Submission_id: 2601382 Created at: Sun May 10 2020 22:01:16 GMT+0800 (China Standard Time) Problem_id: 3374 Time: 2 Memory: 1656 */
#include <stdio.h>
#include <math.h>
#include <string.h>
int q,n,i;
int main(){
scanf("%d",&q);
for(i=1;i<=q;i++){
scanf("%d",&n);
if(n%2==0) puts("YangHui") ;
else if(n&1) puts("Suzumiya");
}
return 0;
}
补充
H
/* Author: 张皓南 Result: AC Submission_id: 2605648 Created at: Wed May 13 2020 12:23:05 GMT+0800 (China Standard Time) Problem_id: 3376 Time: 12 Memory: 3752 */
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <ctype.h>
int n;
struct NODE{
char zhn[233];
int len;
}lgr[10005];
int cmp(const void *a,const void *b){
if ((*(struct NODE *)a).len != (*(struct NODE *)b).len){
return(*(struct NODE *)a).len > (*(struct NODE *)b).len;
}
else return strcmp((*(struct NODE *)a).zhn , (*(struct NODE *)b).zhn);
}
int main(){
n=0;
while(gets(lgr[n].zhn)!=NULL){
lgr[n].len=strlen(lgr[n].zhn);
n++;
}
int i;
qsort(lgr,n,sizeof(lgr[1]), cmp);
for(i=0;i<n;i++)puts(lgr[i].zhn);
return 0;
}
J
/* Author: 张皓南 Result: AC Submission_id: 2605584 Created at: Wed May 13 2020 12:03:19 GMT+0800 (China Standard Time) Problem_id: 3373 Time: 1059 Memory: 45012 */
#include <stdio.h>
#include <string.h>
#include <math.h>
int q,n,i,j;
long long biao[2333][2333];
long long f(int n, int x, int y) {
if (n==0) return 1;
int m=1<<(n-1);
if (x<=m&&y<=m){
return f(n-1,y,x);
}
if (x>m&&y <= m) {
return 3LL*m*m+f(n-1,m+1-y,m*2-x+1);
}
if (x<=m&& y>m) {
return 1LL*m*m+f(n-1,x,y-m);
}
if (x>m&&y>m) {
return 2LL*m*m+f(n-1,x-m,y-m);
}
}
int main(){
scanf("%d",&q);
while(q--){
scanf("%d",&n);
memset(biao,0,sizeof(biao));
for(i=1;i<=pow(2,n);i++){
for(j=1;j<=pow(2,n);j++){
biao[j][i]=f(n,i,j);
}
}
for(i=1;i<=pow(2,n);i++){
for(j=1;j<=pow(2,n);j++){
printf("%lld ", biao[i][j]);
}
printf("\n");
}
}
return 0;
}