MINIMUM COINS题解 codeEval
来源:互联网 发布:四方软件论坛 编辑:程序博客网 时间:2024/06/07 20:27
思路: 用贪心法,先用面值5的硬币凑,然后是3的 最后是1的
#include <iostream>#include <fstream>#include <string>using namespace std;int main (int argc, char* argv[]) {ifstream file;string lineBuffer;file.open(argv[1]);while (!file.eof()) {getline(file, lineBuffer);if (lineBuffer.length() == 0)continue; //ignore all empty lineselse {double centerX, centerY, radius, pointX, pointY;double x, y;sscanf(lineBuffer.c_str(), "Center: (%lf, %lf); Radius: %lf; Point: (%lf, %lf)", ¢erX, ¢erY, &radius, &pointX, &pointY);x = pointX - centerX;y = pointY - centerY;if(x*x + y*y - radius*radius < 0.01)cout << "true" << endl;elsecout << "false" << endl;}}return 0;}
0 0
- MINIMUM COINS题解 codeEval
- Number Of Ones题解 codeEval
- codechef - Bytelandian gold coins 题解
- POJ 1742/HDU2844 Coins 题解
- 【题解】[hdu3473]Minimum Sum
- POJ3260The Fewest Coins题解动态规划DP
- POJ 1742 Coins 多重背包题解
- Codeforces 875B Sorting the Coins 题解
- LeetCode题解:Minimum Window Substring
- LeetCode题解:Minimum Path Sum
- LeetCode - Minimum Window Substring 题解
- hdu1349(题解) Minimum Inversion Number
- Lintcode44 Minimum Subarray solution 题解
- LeetCode64. Minimum Path Sum题解
- codeeval评分标准解析
- PENULTIMATE WORD解题思路 codeEval
- LONGEST WORD 解题思路 codeEval
- LeetCode题解:Minimum Depth of Binary Tree
- 数据存储之sharePreference
- 感悟人生
- Hadoop学习常用的Linux命令
- 小明求素数积
- 黑马程序员_Dom
- MINIMUM COINS题解 codeEval
- 黑马程序员_WPF
- STC单片机学习----ADC
- 小明的难题
- 嵌入式QT的编译
- 读书笔记---《理解Unix进程》
- 虚表/虚指针
- 黑马程序员_网络编程
- 使用C内置的float类型来建模一个FIR滤波器