ZZULIOJ 1430 1435
来源:互联网 发布:linux全局翻墙教程 编辑:程序博客网 时间:2024/06/05 00:54
1435: A+B
Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 208 Solved: 142
SubmitStatusWeb Board
Description
喜闻乐见A+B。
读入两个用英文表示的A和B,计算它们的和并输出。
Input
第一行输入一个字符串,表示数字A;第二行输入一个字符串表示数字B。A和B均为正整数。
Output
输出一个正整数n,表示A+B的和(A+B<100)。
Sample Input
one five
four
three four
two six
Sample Output
1960
HINT
从0到9的对应的英文单词依次为:zero, one , two , three , four , five , six , seven , eight , nine 。
Source
郑轻第六届校赛
水水更健康-.-
代码:
#include<cstdio>#include<cstring>#include<algorithm>using namespace std;char a[120],b[120];int aa,bb;int hua(char ch[]){ int y=0; int ll=strlen(ch); for (int i=0;i<ll;i++) if (i==0||ch[i-1]==' ') { if (ch[i]=='z') y=y*10; else if(ch[i]=='o') y=y*10+1; else if(ch[i]=='t') { if (ch[i+1]=='w') y=y*10+2; else y=y*10+3; } else if(ch[i]=='f') { if (ch[i+1]=='o') y=y*10+4; else y=y*10+5; } else if(ch[i]=='s') { if (ch[i+1]=='i') y=y*10+6; else y=y*10+7; } else if(ch[i]=='e') y=y*10+8; else if(ch[i]=='n') y=y*10+9; } return y;}int main(){ while (gets(a)) { gets(b); aa=hua(a); bb=hua(b); printf("%d\n",aa+bb); } return 0;}
1430: 多少个0
Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 309 Solved: 78
SubmitStatusWeb Board
Description
一个n*n的方格,每个格子中间有一个数字是2或者5,现在从方格的左上角走到右下角,每次只能选择向下或者向右移动一格两种移动方式,让所有经过的格子中的数字相乘,求使最后的结果中末尾处0的数字最少。
Input
第一行是一个正整数n(0<n<100)。
接下来n行是一个n*n的矩阵。
Output
一个正整数m,表示最后的结果末尾处最少有m个0。
Sample Input
4
2 5 2 5
5 2 5 2
2 5 5 5
2 2 2 2
Sample Output
1
HINT
Source
郑轻第六届校赛
代码:
#include<cstdio>#include<cstring>#include<algorithm>using namespace std;int n,s;int map[101][101];int bao[101][101];int main(){while (~scanf("%d",&n)){for (int i=0;i<n;i++)for (int j=0;j<n;j++)scanf("%d",&map[i][j]);if (map[0][0]==2) bao[0][0]=1;else bao[0][0]=0;for (int j=1;j<n;j++)if (map[0][j]==2) bao[0][j]=bao[0][j-1]+1;else bao[0][j]=bao[0][j-1];for (int i=1;i<n;i++)if (map[i][0]==2) bao[i][0]=bao[i-1][0]+1;else bao[i][0]=bao[i-1][0];for (int i=1;i<n;i++)for (int j=1;j<n;j++){bao[i][j]=min(bao[i-1][j],bao[i][j-1]);if (map[i][j]==2) bao[i][j]++;}s=bao[n-1][n-1];if (map[0][0]==5) bao[0][0]=1;else bao[0][0]=0;for (int i=0,j=1;j<n;j++)if (map[0][j]==5) bao[0][j]=bao[0][j-1]+1; else bao[0][j]=bao[0][j-1];for (int i=1;i<n;i++)if (map[i][0]==5) bao[i][0]=bao[i-1][0]+1;else bao[i][0]=bao[i-1][0];for (int i=1;i<n;i++)for (int j=1;j<n;j++){bao[i][j]=min(bao[i-1][j],bao[i][j-1]);if (map[i][j]==5) bao[i][j]++;}s=min(s,bao[n-1][n-1]);printf("%d\n",s);}return 0;}
0 1
- ZZULIOJ 1430 1435
- ZZULIOJ 1430 多少个0【Dp】
- zzulioj--1816
- ZZULIOJ--1798
- zzulioj-1895
- zzulioj-1899
- ZZULIOJ-1894
- 【zzulioj 1922】
- 【zzulioj 1921 】
- zzulioj 1919
- zzulioj 1875
- ZZULIOJ 2121
- ZZULIOJ 2123
- ZZULIOJ 2126
- zzulioj 2134
- 【ZZULIOJ 】 几道水题
- zzulioj 2174
- ZZULIOJ 1726: 迷宫
- mysql 找不到或无法加载已注册的 .Net Framework Data Provider。
- disque基本流程介绍
- 四种可视化技术对比
- PAT 1002. A+B for Polynomials (25)
- 完全背包问题
- ZZULIOJ 1430 1435
- Android应用组件Activity
- [Vulkan教程] 二: Image & Buffer & 内存管理
- 用户代码未处理MetadataException
- 【动态规划】爬台阶
- 从零开始搭建属于自己的博客
- JSON for java入门总结
- [Stellaris][群星]Mod制作指南-编写中-预计6月完成。。大概
- Android Sqlite的基本用法