HDU 5625 Clarke and chemistry(字符串模拟题目)
来源:互联网 发布:matlab矩阵中的最小值 编辑:程序博客网 时间:2024/05/21 18:33
AC代码如下
#include<stdio.h> #include<string.h> #include<iostream> #include<algorithm> using namespace std; int A[105], B[105], C[105]; int main() { int t,n; int a, b, c; char s[5]; scanf("%d", &t); while (t--) { memset(A, 0, sizeof(A)); memset(B, 0, sizeof(B)); memset(C, 0, sizeof(C)); scanf("%d %d %d", &a, &b, &c); int num; for (int i = 0; i < a; i++) { scanf("%s %d", s, &num); A[s[0] - 'A'] = num; } for (int i = 0; i < b; i++) { scanf("%s %d", s, &num); B[s[0] - 'A'] = num; } for (int i = 0; i < c; i++) { scanf("%s %d", s, &num); C[s[0] - 'A'] = num; } int a1, b1; int flag = 1; for (a1 = 1; a1 < 102; a1++) { for (b1 = 1; b1 < 102; b1++) { flag = 1; for (int i = 0; i < 26 && flag; i++) { if (A[i] * a1 + B[i] * b1 != C[i]) { flag = 0; } } if (flag==1) { break; } } if (flag==1) { break; } } if (flag==1) { printf("%d %d\n", a1, b1); } else { printf("NO\n"); } } return 0; }
0 0
- HDU 5625 Clarke and chemistry(字符串模拟题目)
- HDU 5625 Clarke and chemistry(模拟)
- HDU 5625 Clarke and chemistry 模拟
- HDU 5625 Clarke and chemistry
- HDU 5625 Clarke and chemistry
- 【模拟】HDOJ Clarke and chemistry 5625
- HDU 5625 Clarke and chemistry(水~)
- hdoj 5625 Clarke and chemistry
- 杭电 hdu 5625 Clarke and chemistry【水题】
- hdoj--5625--Clarke and chemistry(枚举)
- 杭电5625 Clarke and chemistry
- Clarke and chemistry
- hdu5625 Clarke and chemistry
- bestcoder 72 Clarke and chemistry
- HDU 5463 Clarke and minecraft(模拟)
- hdu 5466 Clarke and expression(模拟)
- BestCoder Round #72 Clarke and chemistry
- HDU 5562 Clarke and food(模拟,看起来像背包)
- 10个影响JavaEE性能问题
- android studio 下载 安装 环境配置
- Javascript变量的命名规则
- 探索推荐引擎内部的秘密,第 2 部分: 深入推荐引擎相关算法 - 协同过滤
- 微信支付服务端与客户端
- HDU 5625 Clarke and chemistry(字符串模拟题目)
- Oracle数据库如何创建Database Link呢
- Java修饰符关键词大全
- Build.VERSION_CODES.HONEYCOMB
- eclipse 汉化教程(中文语言包的下载和安装)
- 51单片机系列知识11--串行通信(2)
- 欢迎使用CSDN-markdown编辑器
- Java不同压缩算法的性能比较
- MySQL允许root帐号远程登录