| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 4113 人关注过本帖
标题:[讨论]第三期题目,大家做做.
只看楼主 加入收藏
weilisky
Rank: 1
等 级:新手上路
帖 子:24
专家分:0
注 册:2006-7-20
收藏
得分:0 
第二题我想先把给20的进制的数转换成10进制的做加法运算,之后在转换成20进制的数,这个应该也是一种方法,应该可行。
2006-11-26 23:12
weilisky
Rank: 1
等 级:新手上路
帖 子:24
专家分:0
注 册:2006-7-20
收藏
得分:0 
再想想那个10转20可能困难一些,
2006-11-26 23:14
mp3aaa
Rank: 5Rank: 5
等 级:贵宾
威 望:17
帖 子:2013
专家分:8
注 册:2006-2-15
收藏
得分:0 
以下是引用我不是郭靖在2006-11-26 22:45:42的发言:
我觉得规律是:

142857 * 7 = 999999
052631578947368421 * 19 = 999999999999999999
0434782608695652173913 * 23 = 9999999999999999999999

也即

序列 * (序列长度 + 1) = 序列长度个9

[此贴子已经被作者于2006-11-26 23:32:22编辑过]


羊肉串 葡萄干 哈密瓜!!
2006-11-26 23:25
我不是郭靖
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:494
专家分:6
注 册:2006-10-4
收藏
得分:0 

2-300满足条件的:

1/7=0.(142857)
1/17=0.(0588235294117647)
1/19=0.(052631578947368421)
1/23=0.(0434782608695652173913)
1/29=0.(0344827586206896551724137931)
1/47=0.(0212765957446808510638297872340425531914893617)
1/59=0.(0169491525423728813559322033898305084745762711864406779661)
1/61=0.(016393442622950819672131147540983606557377049180327868852459)
1/97=0.(010309278350515463917525773195876288659793814432989690721649484536082474
226804123711340206185567)
1/109=0.(00917431192660550458715596330275229357798165137614678899082568807339449
5412844036697247706422018348623853211)
1/113=0.(00884955752212389380530973451327433628318584070796460176991150442477876
10619469026548672566371681415929203539823)
1/131=0.(00763358778625954198473282442748091603053435114503816793893129770992366
41221374045801526717557251908396946564885496183206106870229)
1/149=0.(00671140939597315436241610738255033557046979865771812080536912751677852
34899328859060402684563758389261744966442953020134228187919463087248322147651)
1/167=0.(00598802395209580838323353293413173652694610778443113772455089820359281
43712574850299401197604790419161676646706586826347305389221556886227544910179640
718562874251497)
1/179=0.(00558659217877094972067039106145251396648044692737430167597765363128491
62011173184357541899441340782122905027932960893854748603351955307262569832402234
636871508379888268156424581)
1/181=0.(00552486187845303867403314917127071823204419889502762430939226519337016
57458563535911602209944751381215469613259668508287292817679558011049723756906077
34806629834254143646408839779)
1/193=0.(00518134715025906735751295336787564766839378238341968911917098445595854
92227979274611398963730569948186528497409326424870466321243523316062176165803108
80829015544041450777202072538860103626943)
1/223=0.(00448430493273542600896860986547085201793721973094170403587443946188340
80717488789237668161434977578475336322869955156950672645739910313901345291479820
62780269058295964125560538116591928251121076233183856502242152466367713)
1/229=0.(00436681222707423580786026200873362445414847161572052401746724890829694
32314410480349344978165938864628820960698689956331877729257641921397379912663755
45851528384279475982532751091703056768558951965065502183406113537117903930131)
1/233=0.(00429184549356223175965665236051502145922746781115879828326180257510729
61373390557939914163090128755364806866952789699570815450643776824034334763948497
85407725321888412017167381974248927038626609442060085836909871244635193133047210
3)
1/257=0.(00389105058365758754863813229571984435797665369649805447470817120622568
09338521400778210116731517509727626459143968871595330739299610894941634241245136
18677042801556420233463035019455252918287937743190661478599221789883268482490272
3735408560311284046692607)
1/263=0.(00380228136882129277566539923954372623574144486692015209125475285171102
66159695817490494296577946768060836501901140684410646387832699619771863117870722
43346007604562737642585551330798479087452471482889733840304182509505703422053231
9391634980988593155893536121673)
1/269=0.(00371747211895910780669144981412639405204460966542750929368029739776951
67286245353159851301115241635687732342007434944237918215613382899628252788104089
21933085501858736059479553903345724907063197026022304832713754646840148698884758
3643122676579925650557620817843866171)
Press any key to continue


2006-11-26 23:29
我不是郭靖
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:494
专家分:6
注 册:2006-10-4
收藏
得分:0 
题目要求序列的长度2-60

所以满足条件的只有:
1/7=0.(142857)
1/17=0.(0588235294117647)
1/19=0.(052631578947368421)
1/23=0.(0434782608695652173913)
1/29=0.(0344827586206896551724137931)
1/47=0.(0212765957446808510638297872340425531914893617)
1/59=0.(0169491525423728813559322033898305084745762711864406779661)
1/61=0.(016393442622950819672131147540983606557377049180327868852459)

只存在这8个序列是满足的.

2006-11-26 23:32
failgod
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2006-4-13
收藏
得分:0 

我有点迷糊,本人数学知识比较少,想请问大大们,这个“循环节”到底是怎么会事?能不能翻译以下这个题目,我英语很烂,正在恶补。。。

2006-11-27 16:58
卧龙孔明
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:59
帖 子:3872
专家分:684
注 册:2006-10-13
收藏
得分:0 
以下是引用我不是郭靖在2006-11-26 22:45:42的发言:
我觉得规律是:

142857 * 7 = 999999
052631578947368421 * 19 = 999999999999999999
0434782608695652173913 * 23 = 9999999999999999999999

也即

序列 * (序列长度 + 1) = 9999....999

但同样是不能作为主要的判断方式,如:
11111111*9=99999999
但11111111不是呀


My Blog: www.aiexp.info
虽然我的路是从这里开始的,但是这里不再是乐土.感谢曾经影响过,引导过,帮助过我的董凯,飞燕,leeco,starwing,Rockcarry,soft_wind等等等等.别了,BCCN.
2006-11-27 20:40
我不是郭靖
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:494
专家分:6
注 册:2006-10-4
收藏
得分:0 
以下是引用卧龙孔明在2006-11-27 20:40:28的发言:

但同样是不能作为主要的判断方式,如:
11111111*9=99999999
但11111111不是呀

是啊,还有33 * 3也不是
但从前边分析2-60长度的只有8个序列,所以只要和这8个序列比较就行了.

#include <stdio.h>
#include <string.h>

char *s[] =
{
"142857",
"0588235294117647",
"052631578947368421",
"0434782608695652173913",
"0344827586206896551724137931",
"0212765957446808510638297872340425531914893617",
"0169491525423728813559322033898305084745762711864406779661",
"016393442622950819672131147540983606557377049180327868852459"
};

int main()
{
char str[100];

while (EOF != scanf("%s", str))
{
int i, n;

n = sizeof s / sizeof s[0];
for (i = 0; i < n; i++)
if (strcmp(s[i], str) == 0)
{
printf("%s is cyclic\n", str);
break;
}
if (i == n)
printf("%s is not cyclic\n", str);
}

return 0;
}


2006-11-27 21:16
nuciewth
Rank: 14Rank: 14Rank: 14Rank: 14
来 自:我爱龙龙
等 级:贵宾
威 望:104
帖 子:9786
专家分:208
注 册:2006-5-23
收藏
得分:0 
以下是引用我不是郭靖在2006-11-27 21:16:07的发言:

是啊,还有33 * 3也不是
但从前边分析2-60长度的只有8个序列,所以只要和这8个序列比较就行了.

#include <stdio.h>
#include <string.h>

char *s[] =
{
"142857",
"0588235294117647",
"052631578947368421",
"0434782608695652173913",
"0344827586206896551724137931",
"0212765957446808510638297872340425531914893617",
"0169491525423728813559322033898305084745762711864406779661",
"016393442622950819672131147540983606557377049180327868852459"
};

int main()
{
char str[100];

while (EOF != scanf("%s", str))
{
int i, n;

n = sizeof s / sizeof s[0];
for (i = 0; i < n; i++)
if (strcmp(s[i], str) == 0)
{
printf("%s is cyclic\n", str);
break;
}
if (i == n)
printf("%s is not cyclic\n", str);
}

return 0;
}

在竞赛时,这个是最有效的方法.但是,为了做好题目,应该要写出个程序来.而不是这个样子的.


倚天照海花无数,流水高山心自知。
2006-11-28 10:56
huoshi91
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2006-11-10
收藏
得分:0 
static void Main(string[] args)
{
Console.WriteLine("请输入第一个10位数");
string s1=Console.ReadLine();
Console.WriteLine("请输入第二个10位数");
string s2=Console.ReadLine ();
int[] s3=new int [10];
int i=0;
while( i<10)
{
int s=0;
s =((int)GetNumber(Convert.ToChar(s1[i]))-48)+(int)GetNumber(Convert.ToChar(s2[i]));
if(s==0)
{
s3[i]=0;
}
else
{
s=s%20;
s3[i]=s;
}

Console.Write ("{0}",s3[i].ToString ());
i++;
}

}
private static int GetNumber(char s)
{
switch(s)
{
case 'a':
return 10;
case 'b':
return 11;
case 'c':
return 12;
case 'd':
return 13;
case 'e':
return 14;
case 'f':
return 15;
case 'g':
return 16;
case 'h':
return 17;
case 'i':
return 18;

case'j':
return 19;
default:
return
s;

}
}
}

这个第二题是我C#写的,C也一样,请指教

肯定能成为高手的!
2006-11-28 17:15
快速回复:[讨论]第三期题目,大家做做.
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.042243 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved