东方博弈OJ/1181~1200解析

1181

#include <bits/stdc++.h> 
using namespace std;
int main()
{
	int n;
	cin >> n;
	getchar();
	string a;
	int num = 0;
	for (int i = 1; i <= n; i++)
	{
		getline(cin, a);
		if (!(a[0] == 65 || a[0] == 66 || a[0] == 67 || a[0] == 68 || a[0] == 69 || a[0] == 70 || a[0] == 71 || a[0] == 82 || a[0] == 83 || a[0] == 84))
		{
			num++;
		}
	}
	cout << num;
	return 0;
}

1182

#include <bits/stdc++.h> 
using namespace std;
int main()
{
	string a;
	getline(cin, a);
	for (int i = 0; i < a.size(); i++)
	{
		if (a[i] >= 65 && a[i] <= 90)
		{
			a[i] += 32;
			cout << a[i];
		}
		else if(a[i]>=97&&a[i]<=122)
		{
			a[i] -= 32;
			cout << a[i];
		}
		else
		{
			cout << a[i];
		}
	}
	return 0;
}

 1183

#include <bits/stdc++.h> 
using namespace std;
int main()
{
	int n;
	cin >> n;
	int* p = new int[n];
	for (int i = 0; i < n; i++)
	{
		cin >> p[i];
	}
	sort(p, p + n);
	int num = 0;
	int judge = 0;
	for (int i = 0; i < n; i++)
	{
		for (int j = i - 1; j >= 0; j--)
		{
			if (p[i] == p[j])
			{
				judge = 1;
			}
		}
		if (judge == 0)
		{
			num++;
		}
		judge = 0;
	}
	cout << num << endl;
	for (int i = 0; i < n; i++)
	{
		for (int j = i - 1; j >= 0; j--)
		{
			if (p[i] == p[j])
			{
				judge = 1;
			}
		}
		if (judge == 0)
		{
			cout << p[i] << endl;
		}
		judge = 0;
	}
	delete[]p;
	return 0;
}

1184

#include <bits/stdc++.h> 
using namespace std;
int main()
{
	int n;
	cin >> n;
	int num = 1;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			cout << setw(3) << num;
			num++;
		}
		cout << endl;
	}
	return 0;
}

1185

#include <bits/stdc++.h> 
using namespace std;
int main()
{
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		int num = n * (n - i) + 1;
		for (int j = 1; j <= n; j++)
		{
			cout << setw(3) << num;
			num++;
		}
		cout << endl;
	}
	return 0;
}

1186

#include <bits/stdc++.h> 
using namespace std;
int main()
{
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			cout << setw(3) << i + (j - 1) * n;
		}
		cout << endl;
	}
	return 0;
}

1187

#include <bits/stdc++.h> 
using namespace std;
int main()
{
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			cout << setw(3) << n * (n - 1) + i - (j - 1) * n;
		}
		cout << endl;
	}
	return 0;
}

1188

#include <bits/stdc++.h> 
using namespace std;
int main()
{
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			cout << setw(3) << n * (n - i + 1) - (j - 1);
		}
		cout << endl;
	}
	return 0;
}

1189

#include <bits/stdc++.h> 
using namespace std;
int main()
{
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			cout << setw(3) << n * i - (j - 1);
		}
		cout << endl;
	}
	return 0;
}

1190

#include <bits/stdc++.h> 
using namespace std;
int main()
{
	int n;
	int a[10][10];
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			if (i == j)
			{
				a[i][j] = 1;
				cout << setw(3) << a[i][j];
			}
			else
			{
				a[i][j] = 0;
				cout << setw(3) << a[i][j];
			}
		}
		cout << endl;
	}
	return 0;
}

1191

#include <bits/stdc++.h> 
using namespace std;
int main()
{
	int n;
	int a[10][10];
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			if (j ==n+1-i)
			{
				a[i][j] = 1;
				cout << setw(3) << a[i][j];
			}
			else
			{
				a[i][j] = 0;
				cout << setw(3) << a[i][j];
			}
		}
		cout << endl;
	}
	return 0;
}

1192

#include <bits/stdc++.h> 
using namespace std;
int main()
{
	int n;
	int a[10][10];
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			a[i][j] = i + j - 1;
			cout << setw(3) << a[i][j];
		}
		cout << endl;
	}
	return 0;
}

1193

#include <bits/stdc++.h> 
using namespace std;
int main()
{
	int n;
	int a[10][10];
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			if (i + j - 1 <= n)
			{
				a[i][j] = i + j - 1;
				cout << setw(3) << a[i][j];
			}
			else
			{
				a[i][j] = -(i + j) + 2 * n + 1;
				cout << setw(3) << a[i][j];
			}
		}
		cout << endl;
	}
	return 0;
}

1194

#include <bits/stdc++.h> 
using namespace std;
int main()
{
	int n;
	char a[10][10];
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			if (i + j - 1 <= n)
			{
				a[i][j] = 64 + i + j - 1;
				cout << setw(3) << a[i][j];
			}
			else
			{
				a[i][j] = 64 + i + j - n - 1;
				cout << setw(3) << a[i][j];
			}
		}
		cout << endl;
	}
	return 0;
}

1195

#include <bits/stdc++.h> 
using namespace std;
int main()
{
	int n;
	int a[10][10];
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			if (i == j)
			{
				a[i][j] = n;
				cout << setw(3) << a[i][j];
			}
			else
			{
				int num = abs(i - j);
				a[i][j] = n - num;
				cout << setw(3) << a[i][j];
			}
		}
		cout << endl;
	}
	return 0;
}

1196

#include <bits/stdc++.h> 
using namespace std;
int main()
{
	int n;
	int a[10][10];
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			if (j <= i)
			{
				a[i][j] = j;
				cout << setw(3) << a[i][j];
			}
			else
			{
				a[i][j] = i;
				cout << setw(3) << a[i][j];
			}
		}
		cout << endl;
	}
	return 0;
}

1197

#include <bits/stdc++.h> 
using namespace std;
int main()
{
	int n;
	int a[10][10];
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			if (j <= i)
			{
				a[i][j] = n + 1 - i;
				cout << setw(3) << a[i][j];
			}
			else
			{
				a[i][j] = n + 1 - j;
				cout << setw(3) << a[i][j];
			}
		}
		cout << endl;
	}
	return 0;
}

1198

#include <bits/stdc++.h> 
using namespace std;
int main()
{
	int n;
	int a[10][10];
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			if (n + 1 - j > n + 1 - i)
			{
				a[i][j] = n + 1 - j;
				cout << setw(3) << a[i][j];
			}
			else
			{
				a[i][j] = n + 1 - i;
				cout << setw(3) << a[i][j];
			}
		}
		cout << endl;
	}
	return 0;
}

1199

#include <bits/stdc++.h> 
using namespace std;
int main()
{
	int n;
	int a[10][10];
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			if (j < i)
			{
				a[i][j] = i;
				cout << setw(3) << a[i][j];
			}
			else
			{
				a[i][j] = j;
				cout << setw(3) << a[i][j];
			}
		}
		cout << endl;
	}
	return 0;
}

1200

#include <bits/stdc++.h> 
using namespace std;
int main()
{
	int n;
	int a[10][10];
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			if (n + 1 - j > i)
			{
				a[i][j] = i;
				cout << setw(3) << a[i][j];
			}
			else
			{
				a[i][j] = n + 1 - j;
				cout << setw(3) << a[i][j];
			}
		}
		cout << endl;
	}
	return 0;
}

 如果你喜欢我的博客可以点个赞支持一下。

  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值