今天主要涉及Object-C中类,对象和方法的使用,这也是与C语言不同的地方,C语言被定义为过程性语言,而Object-C则像Java和C#一样是面向对象。一段代码开始新的学习,首先新建文件 main.m 主函数, NSObject+Fraction.h(如同java中定义接口)和NSObject+...
分类:
其他好文 时间:
2014-10-29 07:04:20
阅读次数:
266
题目链接:点击打开链接
#include
#include
typedef unsigned long long ll;
const int key = (int)(1e9) + 7;
const int N = 150010;
char b[N], a[N + N];
ll xp[N], h[N + N];
int len;
void get() {
char ch;
wh...
分类:
其他好文 时间:
2014-09-18 16:31:24
阅读次数:
170
Problem 33
The fraction 49/98 is a curious fraction, as an inexperienced mathematician in attempting to simplify it may incorrectly believe that49/98 = 4/8, which is correct, is obtained by cance...
分类:
其他好文 时间:
2014-08-22 16:17:19
阅读次数:
172
A unit fraction contains 1 in the numerator. The decimal representation of the unit fractions with denominators 2 to 10 are given:
1/2
=
0.5
1/3
=
0.(3)
1/4
=
0.25
1/5...
分类:
其他好文 时间:
2014-08-20 16:25:32
阅读次数:
157
先上题目:Continued FractionTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 131072/65536 K (Java/Others)Total Submission(s): 332Accepted Submission(s):...
分类:
其他好文 时间:
2014-08-17 02:25:21
阅读次数:
241
//在.h文件里
{
NSInteger_numerator;//分子
NSInteger_denominator;//分母
}
//属性
@property(nonatomic)NSIntegernumerator;
@property(nonatomic)NSIntegerdenominator;
//初始化
-(id)initwithNumerator:(NSInteger)numeratordenominator:(NSInteger)denominator;
//..
分类:
其他好文 时间:
2014-08-12 03:32:14
阅读次数:
144
/*
ID: lucien23
PROG: frac1
LANG: C++
*/
#include
#include
#include
#include
using namespace std;
typedef struct Fraction
{
int numerator;
int denominator;
Fraction(){}
Fraction(int x, int y...
分类:
其他好文 时间:
2014-07-19 02:31:25
阅读次数:
199
题目链接:uva 10555 - Dead Fraction
题目大意:给出一个小数,从...开始可以是任何数字,但是保证是无限循环小数,将该小数用分式的形式表示,并且要求分母尽量大。
解题思路:这题主要是怎么将无限循环小数转换成分式,这样的:
有小数0.abcdEEE,未循环部分长4,循环节为E,E的长度为i(假设)abcd+E999…(i位9)10i
#include
#...
分类:
其他好文 时间:
2014-07-08 21:00:18
阅读次数:
146
UVA 10555 - Dead Fraction
题目链接
题意:给定一个循环小数,不确定循环节,求出该小数用分数表示,并且分母最小的情况
思路:推个小公式
一个小数0.aaaaabbb... 表示为n/m形式,并且a为整数部分有c位, b为小数部分有d位
那么aaaaa.bbb...和aaaaabbb....分别可以表示为10c?(n/m)和10c+d?(n/m)
两式...
分类:
其他好文 时间:
2014-07-06 08:29:07
阅读次数:
351
#include using namespace std;int
GreatestCommonDivisor(int m,int n) //辗转相除法求最大公约数{ int r; do { r = m % n; m = n;
...
分类:
编程语言 时间:
2014-05-14 11:18:00
阅读次数:
675