Test SRM Level One: TemperatureScales
题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=6038
因为TopCoder SRM比赛使用的编译器进行了升级,所以进行了一次Test SRM,这次比赛不计rating. 题目是从SRM 200 -400间随机选择的。
这道题目就是解一个二元一次方程。
代码如下:
#include <iostream> using namespace std; class TemperatureScales
{
public:
double convert(int f1, int b1, int f2, int b2, int t);
}; double TemperatureScales::convert(int f1, int b1, int f2, int b2, int t)
{
double a, b; a = ( (double)(f2 - b2) ) / (f1 - b1);
b = ( (double)(f1*b2 - f2*b1) ) / (f1 - b1);
return (double)(a * t + b);
}
Test SRM Level One: TemperatureScales的更多相关文章
- Test SRM Level Two: CountExpressions, Brute Force
题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=8157 这道题目跟扑克牌算24的题目比较像,但要简单一些.点击查 ...
- Test SRM Level Three: LargestCircle, Brute Force
题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=3005&rd=5858 思路: 如果直接用Brute F ...
- SRM 223 Div II Level Two: BlackAndRed,O(N)复杂度
题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=3457&rd=5869 解答分析:http://comm ...
- SRM 207 Div II Level Two: RegularSeason,字符串操作(sstream),多关键字排序(操作符重载)
题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=2866&rd=5853 主要是要对字符串的操作要熟悉,熟 ...
- SRM 577 Div II Level Two: EllysRoomAssignmentsDiv2
题目来源: http://community.topcoder.com/tc?module=ProblemDetail&rd=15497&pm=12521 这个问题要注意的就是只需要直 ...
- SRM 582 Div II Level One: SemiPerfectSquare
题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=12580 比较简单,代码如下: #include <ios ...
- SRM 582 Div II Level Two SpaceWarDiv2
题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=12556 #include <iostream> # ...
- SRM 582 Div II Level Three: ColorTheCells, Brute Force 算法
题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=12581 Burte Force 算法,求解了所有了情况,注意 ...
- SRM 583 Div II Level One:SwappingDigits
题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=12609 #include <iostream> # ...
随机推荐
- Delphi事件的广播2
上篇文章写了将事件分离成类的方法来实现事件的广播,这次将参考观察者模式来实现事件的广播.模式中主要有这两个角色: 发布者:发布者保存着一张观察者的列表,以便在必要的时候调用观察者的方法. 观察者:观察 ...
- java中int,float,long,double取值范围,内存泄露
java中int,float,long,double取值范围是多少? 写道 public class TestOutOfBound { public static void main(String[] ...
- [Android学习笔记]组合控件的使用
组合控件的使用 开发过程中,多个UI控件需要协同工作,相互交互之后,才可完成一个完整的业务需求,此时可把这些控件封装成为一个整体,相互之间的交互逻辑封装其中,外部调用可无需关心内部逻辑,只需获取处理后 ...
- 一个发送邮件的C++库–jwsmtp
接收邮件的,暂时没搞定,不过在SF上找到了这个发送邮件的库文件.它提供了一个比较完整的类,可以简单的调用发送邮件.下面是作者提供的一个例子,不过由于连SMTP发邮件需要密码,所以代码我改了一下.// ...
- 上mongodb创建一些吸取的经验教训指数
想来接触mongodb它已经快一年了,对于其指数已经积累了很多的经验,知识,以这个夜黑风高的优势,放mongodb总结一番吧. 一,索引介绍 mongodb具有两类索引,分别为单键索引和复合索引. 1 ...
- shell脚本查看网络配置
#!/bin/bash ifconfig|grep -E 'eth|inet'|grep -Ev '(inet6|127.0.0.1)'|sed 's/ /\n/g'|awk NF|grep -Ev ...
- sd nfrmtl
http://www.zhihu.com/collection/24337307 http://www.zhihu.com/collection/24337259 http://www.zhihu.c ...
- 《C/C++专项练习》 — (3)
序 第三次C/C++专项.嗯,要抗住打击,继续加油~ 错题分析与总结 1 . 在64位系统中.有例如以下类: class A { public: void *p1; private: void *p2 ...
- 类似于qq联系人的tablview能够展开和收缩
在.h文件中定义三个数组和一个tablview UITableView *listTable; NSMutableArray *listArray; NSMutableArray *p ...
- Trie图和Fail树
Trie图和AC自动机的区别 Trie图是AC自动机的确定化形式,即把每个结点不存在字符的next指针都补全了.这样做的好处是使得构造fail指针时不需要next指针为空而需要不断回溯. 比如构造ne ...