南阳 485 A*B Problem
来源:互联网 发布:小程序淘宝客怎么样 编辑:程序博客网 时间:2024/06/05 05:01
解题思路:
弃九法
#include<stdio.h>#include<string.h>int main(){ char s1[20],s2[20]; int n,i,sum1,sum2,a,b; scanf("%d",&n); while(n--) { scanf("%s%s",s1,s2); a=strlen(s1); b=strlen(s2); for(sum1=i=0;i<a;i++) sum1+=s1[i]-'0'; for(sum2=i=0;i<b;i++) sum2+=s2[i]-'0'; if(sum1==0||sum2==0) printf("0\n");//考虑特殊数据0; else{ sum1=(sum1*sum2)%9; if(sum1) printf("%d\n",sum1); else printf("9\n");//!!! } } return 0;}
0 0
- 南阳 485 A*B Problem
- 南阳oj 485 A*B Problem
- 南阳理工ACM 485A*B Problem
- 南阳 A+B Problem II
- 南阳524 A-B Problem
- 南阳理工:A+B Problem II
- 南阳 103 A+B Problem II
- 南阳844 A+B Problem(V)
- 南阳oj 题目1 A+B Problem
- 南阳题目1-A+B Problem
- 南阳oj 103 A+B Problem II
- 南阳oj 524 A-B Problem
- 南阳103 A+B Problem II
- 南阳ACM 844 A+B Problem(V)
- 南阳 524 A-B Problem(java中的类BigDecimal)
- 南阳理工ACM-题目1A+B Problem
- 南阳理工ACM-题目1101 A+B Problem
- 南阳oj 题目477 A+B Problem III
- POJ 2796 Feel Good 并查集
- PHP之Composer类库依赖管理神器
- ASP.net读取EXCEL文件将内容存储到GridView中
- 智能电视TV开发---如何实现程序省电
- Spring MVC数据绑定大全
- 南阳 485 A*B Problem
- 2.1 设置action栏
- 南阳 105 9的余数
- Chromium on Android: 认识Chromium WebView
- Eclipse下开发Django
- 数据挖掘概述
- 11 insert buffer
- ACM学习计划
- hdu 1249 三角形