1394
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
using namespace std;
int n;
int main (){
while (cin>>n,n){
int a[110];
for (int i = 0; i < n; i ++ ){
cin>>a[i];
}
sort(a,a+n);
cout<<a[n-1]<<'\n';
}
}
2061
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
using namespace std;
int n,m;
int main (){
while (scanf ("%d",&n)&&n!=-1){
map <int,int> mp;
int x;
for (int i=1;i<=n;i++){
scanf("%d", &x);
mp[x]++;
}
scanf("%d", &m);
for (int i = 1; i <= m; i ++ ){
scanf("%d", &x);
printf ("%s\n",mp[x]?"YES":"NO");
}
puts("");
}
}
2067
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
using namespace std;
int T,n;
int main (){
scanf("%d", &T);
string op,u,ed;
op=">+",ed="+>";
for (int i = 0; i < 39; i ++ ){
u+='-';
}
while (T--){
scanf("%d", &n);
vector <vector <int>> s;
for (int i = 0; i < n; i ++ ){
int a,b;
scanf ("%d %d\n",&a,&b);
s.push_back({a,b});
}
sort(s.begin(),s.end());
for (int i = 0; i <n; i ++){
string ans=op;
ans+=u.substr(0,s[i][0]-2);
ans+=ed;
while (s[i][1]--) cout<<ans<<'\n';
puts("");
}
}
}
2078
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
using namespace std;
// 考输入输出
// 大范围数据1e5以上能不用cin,cout就不用,用scanf,printf
int x;
long long ans;
int main (){
while (scanf ("%d",&x)!=EOF){
//ans+=x<151?30:(x<261?100:500);
if (x<151) ans+=30;
else if (x<261) ans+=100;
else ans+=500;
}
printf ("%lld\n",ans);
}
2079
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#define f first
#define s second
using namespace std;
//经典bfs
typedef pair<int, int> pii;
int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, 1, 0, -1};
int n,m,d[110][110];//存步数
char g[110][110];//存地图
bool st[110][110];//存是否走过 走过的话就不用走了
int lx,ly,rx,ry;
void bfs(){
queue <pii> q;//定义一个队列 不会的话csdn搜一下
q.push({lx,ly});//存入pair得在加个{}
st[lx][ly]=1;
while (q.size()){
auto t=q.front();
q.pop();
for (int i=0;i<4;i++){
int a=t.f+dx[i],b=t.s+dy[i];
if (a>=1&&a<=n&&b>=1&&b<=m&&
!st[a][b]&&g[a][b]!='#'){
//一定要先确定ab没有越界
//才能进行判断有无走过与是否可走
d[a][b]=d[t.f][t.s]+1;
st[a][b]=1;
q.push({a,b});
}
}
}
}
int main (){
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; i ++ ){
scanf ("%s",g[i]+1);
for (int j=1;j<=m;j++){
if (g[i][j]=='@'){
lx=i,ly=j;
}
if (g[i][j]=='*'){
rx=i,ry=j;
}
}
}
bfs();
// for (int i = 1; i <= n; i ++ ){
// for (int j=1;j<=m;j++){
// printf ("%d ",d[i][j]);
// }
// puts("");
// }
if (!d[rx][ry]) puts("Impossibility!");
else printf ("%d\n",d[rx][ry]);
}