#include<iostream>#include<algorithm>usingnamespace std;intmain(){int n; cin >> n;int res =0;while(n) res += n %10, n /=10;
cout << res << endl;return0;}
#include<iostream>usingnamespace std;constint N =33;int n, m;int g[N][N];bool st[N][N];intmain(){
cin >> n >> m;for(int i =0; i < n; i++)for(int j =0; j < m; j++)
cin >> g[i][j];for(int i =0; i < n; i++)for(int j =0; j < m; j++){int l = j, r = j, u = i, d = i, x = g[i][j];while(l >=0&& g[i][l]== x) l--;while(r < m && g[i][r]== x) r++;while(u >=0&& g[u][j]== x) u--;while(d < n && g[d][j]== x) d++;
st[i][j]= r - l -1>=3|| d - u -1>=3;}for(int i =0; i < n; i++){for(int j =0; j < m; j++)if(st[i][j]) cout <<0<<' ';else cout << g[i][j]<<' ';
cout << endl;}return0;}
#include<iostream>#include<algorithm>#include<cstring>usingnamespace std;constint N =110;int n, m, Q;char g[N][N];bool st[N][N];int dx[]={-1,0,1,0}, dy[]={0,1,0,-1};voiddfs(int x,int y,char c){
st[x][y]=true; g[x][y]= c;for(int i =0; i <4; i++){int a = x + dx[i], b = y + dy[i];if(a <0|| a >= m || b <0|| b >= n)continue;if(st[a][b])continue;if(g[a][b]=='-'|| g[a][b]=='|'|| g[a][b]=='+')continue;dfs(a, b, c);}}intmain(){
cin >> m >> n >> Q;for(int i =0; i < m; i++)for(int j =0; j < n; j++)
g[i][j]='.';while(Q--){int op; cin >> op;if(!op){int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;if(x1 > x2)swap(x1, x2);if(y1 > y2)swap(y1, y2);char c ='-', d ='|';if(x1 == x2)swap(c, d);for(int i = x1; i <= x2; i++)for(int j = y1; j <= y2; j++){auto&t = g[i][j];if(t == d || t =='+') t ='+';else t = c;}}else{int x, y;char c; cin >> x >> y >> c;memset(st,0,sizeof st);dfs(x, y, c);}}for(int i = n -1; i >=0; i--){for(int j =0; j < m; j++)
cout << g[j][i];
cout << endl;}return0;}
#include<iostream>#include<algorithm>#include<set>usingnamespace std;constint N =10010, M =100010;int n, m;
set<int> g[N];int p[N];int ans[M], top;intfind(int x){if(p[x]!= x) p[x]=find(p[x]);return p[x];}voiddfs(int u){while(g[u].size()){int t =*g[u].begin();
g[u].erase(t), g[t].erase(u);dfs(t);}
ans[++top]= u;}intmain(){scanf("%d%d",&n,&m);for(int i =1; i <= n; i++) p[i]= i;while(m--){int a, b;scanf("%d%d",&a,&b);
g[a].insert(b), g[b].insert(a);
p[find(a)]=find(b);}int s =0;for(int i =1; i <= n; i++)if(find(i)!=find(1)){puts("-1");return0;}elseif(g[i].size()%2) s++;if(s !=0&& s !=2|| s ==2&& g[1].size()%2==0){puts("-1");return0;}dfs(1);for(int i = top; i; i--)printf("%d ", ans[i]);return0;}