Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define ll long long
- #define el endl
- #define umi unordered_map<int, int>
- #define umll unordered_map<ll, ll>
- #define all(vect) vect.begin(), vect.end()
- #define reset(A) memset(A, 0, sizeof(A))
- #define approx(n) fixed << setprecision(n)
- const int mod = 1e9 + 7;
- using namespace std;
- int palin(char s[500]) {
- int st = 0, en = strlen(s) -1;
- while (st <= en) {
- if (s[st] != s[en])
- return 0;
- st++;
- en--;
- }
- return 1;
- }
- int sum(char s[500])
- {
- int tong=0;
- for(int i=0; i<strlen(s); i++)
- tong += (s[i] - '0');
- return tong;
- }
- int main ()
- {
- int t;
- scanf("%d",&t);
- while (t--) {
- char s[1000];
- scanf("%s",&s);
- if(s[0] != '8' || s[strlen(s) - 1] != '8' || sum(s) % 10 || !palin(s))
- {
- printf("NO\n");
- }
- else
- printf("YES\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement