1.
t=eval(input())
for p in range(t):
n=eval(input())
for i in range(n):
for j in range(n-i-1):
print(" ",end="")
for j in range(1,2*i+2):
if j%2==1:
print("&",end="")
else:
print("*",end="")
print("")
2.代码为c++,抄的以前的
#include <stdio.h>
int main()
{
int n,m,k;
int i,o,p;
int arr1[50][50];
int arr2[50][50];
int arr3[50][50];
scanf ("%d %d %d",&n,&m,&k);
for (i=1;i<=n;i++)
{
for (o=1;o<=m;o++)
{
scanf ("%d",&arr1[i][o]);
}
}
for (i=1;i<=m;i++)
{
for (p=1;p<=k;p++)
{
scanf ("%d",&arr2[i][p]);
}
}
for (o=1;o<=n;o++)
{
for (p=1;p<=k;p++)
{
arr3[o][p]=0;
}
}
for (i=1;i<=n;i++)
{
for (o=1;o<=k;o++)
{
for (p=1;p<=m;p++)
{
arr3[i][o] +=arr1[i][p]*arr2[p][o];
}
}
}
for (i=1;i<=n;i++)
{
for (o=1;o<=k;o++)
{
printf ("%d ",arr3[i][o]);
if (o==k)
{
printf ("\n");
}
}
}
return 0;
}
3.
all_word=list(map(str,input().split()))
for x in all_word:
if x[0]=='Q' or x[0]=='q':
print(x)
4.只提交check函数即可,先手必胜
int check(int a[],int trees_cnt,int k)
{
if (k==0)
{
return 0;
}else return 666;
}
5.原题有题解:https://blog.csdn.net/balalinhq/article/details/107030238
6.抄的以前的,同样为c++
#include <bits/stdc++.h>
using namespace std;
//const int N=1e5+10;
int main() {
// ios::sync_with_stdio(false);
// cin.tie(0);
// cout.tie(0);
int N,M;
int arr[1100];
while (scanf("%d %d",&N,&M) !=EOF)
{
int i;
int a;
if (N<640)
{
goto a1;
}
for (i=1;i<=M;i++)
{
scanf("%d",&arr[i]);
}
for (i=1;i<=M;i++)
{
N -=640;
N += arr[i];
if (N<0)
{
N=0;
goto a1;
}
else if(N>0 && N<640)
{
goto a1;
}
}
a1:
printf("%d\n",N);
}
return 0;
}
祝大家早日ac~