No to Palindromes,notopalindromes

來源:互聯網
上載者:User

No to Palindromes,notopalindromes

/*題意:給你一個字串,尋找按照字典序排的下一個合格字串下一個滿足的字串一定是改變盡量靠右的字元才能得到(字典序),從最右面開始找,假設當前是第i位,如果i位增加之後滿足和i-1,i-2位均不相同的話,那麼最小的肯定就是從這裡開始改的(因為首碼沒有迴文字串,所以改變i位後的串也不會有),接下來就把後面的為都補全。*/# include<stdio.h># include<algorithm># include<string.h># include<iostream>using namespace std;char a[1234567];int n,p;bool judge(int now){    for(int i=1;; i++)    {        if(a[now]+i>'a'+p-1)            return false;        if(now>0&&a[now]+i==a[now-1])            continue;        if(now>1&&a[now]+i==a[now-2])            continue;        a[now]+=i;        return true;    }}void get(int now){    for(int i=0;; i++)    {        if(now>0&&'a'+i==a[now-1])            continue;        if(now>1&&'a'+i==a[now-2])            continue;        a[now]='a'+i;        return  ;    }}int main(){    scanf("%d%d",&n,&p);    scanf("%s",a);      int ok=0;    int i;    for( i=n-1; i>=0; i--)    {        if(judge(i))        {            ok=1;            break;        }    }    if(ok)    {        for( i=i+1; i<n; i++) //            get(i);        printf("%s\n",a);    }    else        printf("NO\n");    return 0;}


say no to doing還是say no to do

可以類比,say no to the enemy. 也就是說to 是介詞,後面跟一個名詞,或者動名詞。
因此答案為前面的, say no to doing sth。 拒絕做某事。
 
no to do 與to not do的有什不一樣

這種用法是對的原句一個肯定,一個否定,由於肯定在前,不好統一,故出現了這種用法。
有時這種用法也用於對於否定的強調等。
如老友記裡有一句 All my energy is going to not asking that question.
敬請採納!
attempts 在這裡做call 的賓語補助語,這是一個時事裡的常用片語
參考資料:相信自己
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.