赞
踩
- #include<bits/stdc++.h>
- using namespace std ;
- typedef long long ll ;
- const int maxn = 2e5 + 7 ;
- inline ll read(){
- ll x = 0 , f = 1 ;
- char c = getchar() ;
- while(c > '9' || c < '0'){
- if(c == '-')
- f = -1 ;
- c = getchar() ;
- }
- while(c >= '0' && c <= '9'){
- x = x * 10 + c - '0' ;
- c = getchar() ;
- }
- return x * f ;
- }
- ll t , n , m , k , a[maxn] , c[maxn] , b[maxn] ;
- char s[maxn] ;
- void solve(){
- n = read() ;
- ll x = 3 ;
- c[1] = 1 ;
- c[2] = 1 ;
- c[3] = 1 ;
- if(x + 25 <= n){
- c[3] = 26 ;
- x += 25 ;
- }
- else{
- cout << char(c[1] + 'a' - 1) << char(c[2] + 'a' - 1) << char(c[3] + (n - x) + 'a' - 1) << endl ;
- return ;
- }
- if(x + 25 <= n){
- c[2] = 26 ;
- x += 25 ;
- }
- else{
- cout << char(c[1] + 'a' - 1) << char(c[2] + (n - x) + 'a' - 1) << char(c[3] + 'a' - 1) << endl ;
- return ;
- }
- cout << char(c[1] + (n - x) + 'a' - 1) << char(c[2] + 'a' - 1) << char(c[3] + 'a' - 1) << endl ;
- }
- int main(){
- t = read() ;
- while(t --){
- solve() ;
- }
- return 0 ;
- }
- #include<bits/stdc++.h>
- using namespace std ;
- typedef long long ll ;
- const int maxn = 2e5 + 7 ;
- inline ll read(){
- ll x = 0 , f = 1 ;
- char c = getchar() ;
- while(c > '9' || c < '0'){
- if(c == '-')
- f = -1 ;
- c = getchar() ;
- }
- while(c >= '0' && c <= '9'){
- x = x * 10 + c - '0' ;
- c = getchar() ;
- }
- return x * f ;
- }
- ll t , n , m , k , a[maxn] , c[maxn] , b[maxn] ;
- char s[maxn] ;
- void solve(){
- n = read() ;
- ll sum = 0 ;
- for(int i = 1 ; i <= n ; i ++){
- a[i] = read() ;
- sum += a[i] ;
- }
- sum /= n ;
- ll res = 0 ;
- for(int i = 1 ; i <= n ; i ++){
- if(a[i] < sum){
- if((sum - a[i]) > res){
- cout << "NO\n" ;
- return ;
- }
- else{
- res -= (sum - a[i]) ;
- }
- }
- else{
- res += (a[i] - sum) ;
- }
- }
- cout << "YES\n" ;
- }
- int main(){
- t = read() ;
- while(t --){
- solve() ;
- }
- return 0 ;
- }
- #include<bits/stdc++.h>
- using namespace std ;
- typedef long long ll ;
- const int maxn = 2e5 + 7 ;
- inline ll read(){
- ll x = 0 , f = 1 ;
- char c = getchar() ;
- while(c > '9' || c < '0'){
- if(c == '-')
- f = -1 ;
- c = getchar() ;
- }
- while(c >= '0' && c <= '9'){
- x = x * 10 + c - '0' ;
- c = getchar() ;
- }
- return x * f ;
- }
- ll t , n , m , k , a[maxn] , c[maxn] , b[maxn] ;
- char s[maxn] ;
- void solve(){
- n = read() ;
- for(int i = 1 ; i <= n ; i ++){
- a[i] = read() ;
- }
- ll rt = n , Rt = 1 ;
- ll res = a[1] ;
- for(int i = 2 ; i <= n ; i ++){
- if(a[i] != res){
- rt = i - 1 ;
- break ;
- }
- }
- res = a[n] ;
- for(int i = n - 1 ; i >= 1 ; i --){
- if(res != a[i]){
- Rt = i + 1 ;
- break ;
- }
- }
- if(a[1] == a[n]){
- if(Rt <= rt){
- cout << 0 << endl ;
- return ;
- }
- cout << n - rt - (n - Rt + 1) << endl ;
- return ;
- }
- else{
- cout << n - max((n - Rt + 1) , rt) << endl ;
- return ;
- }
- }
- int main(){
- t = read() ;
- while(t --){
- solve() ;
- }
- return 0 ;
- }
- void result() {
- cin >> n >> x >> y;
- map<int, vector< int > > mod_y;
- for (int i = 0; i < n ; i ++) {
- cin >> a[i] ;
- mod_y[a[i] % y].push_back(a[i] % x);
- }
- ll ans{} ;
- for (auto it : mod_y) {
- ll sum{} ;
- map< int , ll > cnt ;
- for (int i = it.S.size() - 1 ; i >= 0 ; i --) {
- if (it.S[i] == 0) {
- sum += (cnt[0]) ;
- }
- sum += (cnt[x - it.S[i]]) ;
- cnt[it.S[i]] ++ ;
- }
- ans += sum ;
- }
- cout << ans ;
- }
- #include<bits/stdc++.h>
- using namespace std ;
- typedef long long ll ;
- const int maxn = 2e5 + 7 ;
- inline ll read(){
- ll x = 0 , f = 1 ;
- char c = getchar() ;
- while(c > '9' || c < '0'){
- if(c == '-')
- f = -1 ;
- c = getchar() ;
- }
- while(c >= '0' && c <= '9'){
- x = x * 10 + c - '0' ;
- c = getchar() ;
- }
- return x * f ;
- }
- ll t , n , m , k , a[maxn] , c[maxn] , b[maxn] ;
- char s[maxn] ;
- void solve(){
- n = read() ;
- m = read() ;
- priority_queue < ll , vector < ll > , less < ll > > q ;
- ll Ans = 0 ;
- for(int i = 1 ; i <= n ; i ++){
- a[i] = read() ;
- ll res = a[i] , cnt = 0 ;
- while(1){
- if(res % 10 == 0){
- cnt ++ ;
- res /= 10 ;
- }
- else{
- break ;
- }
- }
- q.push(cnt) ;
- cnt = 0 ;
- res = a[i] ;
- while(res != 0){
- res /= 10 ;
- cnt ++ ;
- }
- Ans += cnt ;
- }
- ll ans = 0 ;
- while(1){
- if(q.top() == 0 || q.empty()){
- break ;
- }
- ans += q.top() ;
- q.pop() ;
- if(q.empty()){
- break ;
- }
- q.pop() ;
- }
- if(Ans - ans < m + 1){
- cout << "Anna" << endl ;
- return ;
- }
- else{
- cout << "Sasha\n" ;
- }
- }
- int main(){
- t = read() ;
- while(t --){
- solve() ;
- }
- return 0 ;
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。