1770 数数字
来源:互联网 发布:网络攻防实验室 编辑:程序博客网 时间:2024/05/03 01:26
分两种情况1:a*b<=9 所有相乘的情况是相同的 2:a*b>9 循环找到第一个相同的数字
#include<iostream>#include<cstdio>#include<cstring>using namespace std;int main(){int T;scanf("%d",&T);while(T--){int a,b,d,n;int ans=0,c=0,cnt=0;scanf("%d%d%d%d",&a,&b,&d,&n);if(a*b<=9){if(a*b==d){printf("%d\n",n);}else{printf("0\n");}}else{int temp1=(a*b)%10;int temp2=(a*b)/10;//进位 int ans[10]={0};ans[temp1]++;n--;while(n){temp1=(a*b+temp2)%10;temp2=(a*b+temp2)/10;if(ans[temp1]){ans[temp1]+=n;break;}else{ans[temp1]++;}n--;}ans[temp2]++;printf("%d\n",ans[d]);}}return 0;}
0 0
- nod-1770-数数字
- 1770 数数字
- 1770 数数字
- 数数字(51nod 1770)
- 51nod 1770 数数字
- 51nod-【1770 数数字】
- 51nod--1770数数字
- 1770 数数字 51NOD
- 【51Nod】1770 数数字
- 51nod 1770 数数字
- 51nod--1770数数字
- 51nod 1770 数数字
- 51nod 1770 数数字
- 数数字
- 数数字
- 数数字
- 数数字
- 数数字
- 主流web界面播放器的页面引用以及浏览器的支持情况分析(VLC)
- 让浏览器支持Webp
- 深入浅出RxJava(二:操作符)
- web前端开发项目中可能遇到的细节性问题(1)【position,padding+margin】
- PAT 1004 Counting Leaves
- 1770 数数字
- 深入浅出RxJava三--响应式的好处
- 深入浅出RxJava四-在Android中使用响应式编程
- Javascript 读取浏览器名及版本号
- NYOJ-35-表达式求值
- Java 中日期格式的转化
- css3渐变、倒影、过渡 20160526
- Doctype
- PAT 1005 Spell It Right