ural 1104 Don’t Ask Woman about Her Age
2014-03-19 19:16
260 查看
http://acm.timus.ru/problem.aspx?space=1&num=1104
View Code
#include <cstdio> #include <cstring> #include <algorithm> #define maxn 2000000 using namespace std; char s1[maxn]; int main() { scanf("%s",s1); int k=strlen(s1); char ch='+'; int sum=0; for(int i=0; i<k; i++) { if(s1[i]>ch) ch=s1[i]; if(s1[i]>='0'&&s1[i]<='9') sum+=(s1[i]-'0'); else if(s1[i]>='A'&&s1[i]<'Z') sum+=(s1[i]-'A'+10); } int c; if(ch>='0'&&ch<='9') c=ch-'0'; else c=ch-'A'+10; if(c+1<2) c=2; else c++; for(; c<=36; c++) { if(sum%(c-1)==0) break; } if(c<=36) printf("%d\n",c); else if(c>36) printf("No solution.\n"); return 0; }
View Code
相关文章推荐
- URAL 1104 Don’t Ask Woman about Her Age(数论)
- Ural 1104. Don’t Ask Woman about Her Age
- ural 1104. Don’t Ask Woman about Her Age
- ural 1104. Don’t Ask Woman about Her Age
- ural 1104. Don’t Ask Woman about Her Age暴力
- 1104. Don’t Ask Woman about Her Age(数论)
- Timus 1104 Don’t Ask Woman about Her Age
- Timus 1104. Don’t Ask Woman about Her Age
- Don’t Ask Woman about Her Age
- URAL 1993-This cheeseburger you don't need (模拟)
- [职业规划]年龄的重要性 Silicon Valley’s Dark Secret: It’s All About Age
- dream about her again
- Moncler Herre woman but these types
- ural 1993 This cheeseburger you don't need
- Ural 1993 This cheeseburger you don't need
- 转 命令,不要去询问(Tell, Don’t Ask)
- OO设计应该遵循“Tell, don't ask”原则
- They don't care about us中文歌词
- Discussion happned in AskTom about long and LOB types
- 命令,不要去询问(Tell, Don’t Ask)