惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The Hacker News
The Hacker News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
小众软件
小众软件
云风的 BLOG
云风的 BLOG
Martin Fowler
Martin Fowler
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
B
Blog RSS Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 聂微东
L
LangChain Blog
博客园 - 司徒正美
腾讯CDC
C
Cybersecurity and Infrastructure Security Agency CISA
C
Cisco Blogs
M
MIT News - Artificial intelligence
Y
Y Combinator Blog
S
Schneier on Security
T
Tailwind CSS Blog
S
Securelist
P
Proofpoint News Feed
A
Arctic Wolf
有赞技术团队
有赞技术团队
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
P
Privacy & Cybersecurity Law Blog
爱范儿
爱范儿
G
GRAHAM CLULEY
F
Full Disclosure
T
Threat Research - Cisco Blogs
Hugging Face - Blog
Hugging Face - Blog
T
Tor Project blog
T
Threatpost
月光博客
月光博客
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
CXSECURITY Database RSS Feed - CXSecurity.com
AWS News Blog
AWS News Blog
C
CERT Recently Published Vulnerability Notes
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
Simon Willison's Weblog
Simon Willison's Weblog
Microsoft Security Blog
Microsoft Security Blog
雷峰网
雷峰网
I
Intezer
GbyAI
GbyAI
T
The Exploit Database - CXSecurity.com
L
LINUX DO - 热门话题
J
Java Code Geeks
I
InfoQ
Stack Overflow Blog
Stack Overflow Blog
V
Visual Studio Blog
罗磊的独立博客

博客园 - xmx

Amazon 2面杯具 N皇后回溯 "中航文化杯" 2007 ACM/ICPC 国际大学生程序设计竞赛亚洲区域赛(南京) 一个用来练dfs的简单迷宫问题 pku 1662 还是找规律的 pku 1806 Manhattan 2025(找规律) 今天西华的比赛,啥都不说啦,相当的nice!~~~ 今天北京赛区的比赛 pku 1505 copying books(DP) 最近看的一些东西 The 2007 ACM Asia Programming Contest Changchun Site Internet Preliminary Contest nice 位运算果真是好东西,今天算是学到点啦^_^ FOJ月赛-2007年9月 终于有算最长重复子串(数)的后缀数组啦,nice The 2007 ACM Asia Programming Contest - Nanjing Preliminary pku 3219 人家居然用几十B就过了,肯定有超强的规律,可是我自己找了个,挂了...只能老实算... 一道双向dp,差点超时^_^||| dp pku 1050 N和素数P,求杨辉三角第N行中能被P整除的数的个数
pku 1850 前面一直没注意到某个不规范的情况,导致结果一直比标准的大...调了好久...
xmx · 2007-10-03 · via 博客园 - xmx

//数论题,,,,这个做法是正向加求和算的,当然应该也可以反向求出不符合规定的数目,然后减去
#include <iostream>
using namespace std;
__int64 tt(int x,int y)
{
__int64 sum=1;
int i,j;
for(i=0,j=1;i<y;i++)
{
   sum*=(x-i);
   for(;j<=y&&sum%j==0;j++) sum/=j;
}
return sum;
}
int main()
{
string s;
__int64 n;
int i,j;
while(cin>>s)
{
    for(i=0;s[i+1];i++)
    {
     if(s[i]>=s[i+1]) break;
    }
    if(s[i+1]) cout<<0<<endl;
    else
    {
     i=s.length();
     for(--i,n=0;i;i--)
      n+=tt(26,i);
     for(i=0;s[i];i++)
     {
      if(i==0)j='a';
      else j=s[i-1]+1;
      for(;j<s[i];j++)
      {
       n+=tt('z'-j,s.length()-i-1);
      }
     }
     cout<<n+1<<endl;
    }
}
return 0;
}

posted on 2007-10-03 19:58  xmx  阅读(418)  评论()    收藏  举报