-
這篇文章主要是介紹一些在復(fù)習(xí)C語(yǔ)言的過(guò)程中筆者個(gè)人認(rèn)為比較重點(diǎn)的地方,較好的掌握這些重點(diǎn)會(huì)使對(duì)C的運(yùn)用更加得心應(yīng)手。此外會(huì)包括一些細(xì)節(jié)、易錯(cuò)的地方。涉及的主要內(nèi)容包括:變量的作用域和存儲(chǔ)類別、函數(shù)、數(shù)組、字符串、指針、文件、鏈表等。一些最基本的概念在此就不多作解釋了,僅希望能有只言片語(yǔ)給同是C語(yǔ)言初學(xué)者的學(xué)習(xí)和上機(jī)過(guò)程提供一點(diǎn)點(diǎn)的幫助。
標(biāo)簽:
C語(yǔ)言
過(guò)程
比較
上傳時(shí)間:
2014-05-26
上傳用戶:671145514
-
數(shù)字運(yùn)算,判斷一個(gè)數(shù)是否接近素?cái)?shù)
A Niven number is a number such that the sum of its digits divides itself. For example, 111 is a Niven number because the sum of its digits is 3, which divides 111. We can also specify a number in another base b, and a number in base b is a Niven number if the sum of its digits divides its value.
Given b (2 <= b <= 10) and a number in base b, determine whether it is a Niven number or not.
Input
Each line of input contains the base b, followed by a string of digits representing a positive integer in that base. There are no leading zeroes. The input is terminated by a line consisting of 0 alone.
Output
For each case, print "yes" on a line if the given number is a Niven number, and "no" otherwise.
Sample Input
10 111
2 110
10 123
6 1000
8 2314
0
Sample Output
yes
yes
no
yes
no
標(biāo)簽:
數(shù)字
運(yùn)算
上傳時(shí)間:
2015-05-21
上傳用戶:daguda
-
源代碼\用動(dòng)態(tài)規(guī)劃算法計(jì)算序列關(guān)系個(gè)數(shù)
用關(guān)系"<"和"="將3個(gè)數(shù)a,b,c依次序排列時(shí),有13種不同的序列關(guān)系:
a=b=c,a=b<c,a<b=v,a<b<c,a<c<b
a=c<b,b<a=c,b<a<c,b<c<a,b=c<a
c<a=b,c<a<b,c<b<a
若要將n個(gè)數(shù)依序列,設(shè)計(jì)一個(gè)動(dòng)態(tài)規(guī)劃算法,計(jì)算出有多少種不同的序列關(guān)系,
要求算法只占用O(n),只耗時(shí)O(n*n).
標(biāo)簽:
lt
源代碼
動(dòng)態(tài)規(guī)劃
序列
上傳時(shí)間:
2013-12-26
上傳用戶:siguazgb
-
The government of a small but important country has decided that the alphabet needs to be streamlined and reordered. Uppercase letters will be eliminated. They will issue a royal decree in the form of a String of B and A characters. The first character in the decree specifies whether a must come ( B )Before b in the new alphabet or ( A )After b . The second character determines the relative placement of b and c , etc. So, for example, "BAA" means that a must come Before b , b must come After c , and c must come After d .
Any letters beyond these requirements are to be excluded, so if the decree specifies k comparisons then the new alphabet will contain the first k+1 lowercase letters of the current alphabet.
Create a class Alphabet that contains the method choices that takes the decree as input and returns the number of possible new alphabets that conform to the decree. If more than 1,000,000,000 are possible, return -1.
Definition
標(biāo)簽:
government
streamline
important
alphabet
上傳時(shí)間:
2015-06-09
上傳用戶:weixiao99
-
電力系統(tǒng)在臺(tái)穩(wěn)定計(jì)算式電力系統(tǒng)不正常運(yùn)行方式的一種計(jì)算。它的任務(wù)是已知電力系統(tǒng)某一正常運(yùn)行狀態(tài)和受到某種擾動(dòng),計(jì)算電力系統(tǒng)所有發(fā)電機(jī)能否同步運(yùn)行
1運(yùn)行說(shuō)明:
請(qǐng)輸入初始功率S0,形如a+bi
請(qǐng)輸入無(wú)限大系統(tǒng)母線電壓V0
請(qǐng)輸入系統(tǒng)等值電抗矩陣B
矩陣B有以下元素組成的行矩陣
1正常運(yùn)行時(shí)的系統(tǒng)直軸等值電抗Xd
2故障運(yùn)行時(shí)的系統(tǒng)直軸等值電抗X d
3故障切除后的系統(tǒng)直軸等值電抗
請(qǐng)輸入慣性時(shí)間常數(shù)Tj
請(qǐng)輸入時(shí)段數(shù)N
請(qǐng)輸入哪個(gè)時(shí)段發(fā)生故障Ni
請(qǐng)輸入每時(shí)段間隔的時(shí)間dt
標(biāo)簽:
電力系統(tǒng)
正
計(jì)算
運(yùn)行
上傳時(shí)間:
2015-06-13
上傳用戶:it男一枚
-
上下文無(wú)關(guān)文法(Context-Free Grammar, CFG)是一個(gè)4元組G=(V, T, S, P),其中,V和T是不相交的有限集,S∈V,P是一組有限的產(chǎn)生式規(guī)則集,形如A→α,其中A∈V,且α∈(V∪T)*。V的元素稱為非終結(jié)符,T的元素稱為終結(jié)符,S是一個(gè)特殊的非終結(jié)符,稱為文法開(kāi)始符。
設(shè)G=(V, T, S, P)是一個(gè)CFG,則G產(chǎn)生的語(yǔ)言是所有可由G產(chǎn)生的字符串組成的集合,即L(G)={x∈T* | Sx}。一個(gè)語(yǔ)言L是上下文無(wú)關(guān)語(yǔ)言(Context-Free Language, CFL),當(dāng)且僅當(dāng)存在一個(gè)CFG G,使得L=L(G)。 *⇒
例如,設(shè)文法G:S→AB
A→aA|a
B→bB|b
則L(G)={a^nb^m | n,m>=1}
其中非終結(jié)符都是大寫字母,開(kāi)始符都是S,終結(jié)符都是小寫字母。
標(biāo)簽:
Context-Free
Grammar
CFG
上傳時(shí)間:
2013-12-10
上傳用戶:gaojiao1999
-
不知道你有多少次外出時(shí)遇到這樣的場(chǎng)景,反正我是很多次了。對(duì)于攝影者來(lái)說(shuō),人像是最常遇到的拍攝題材之一,除了本身它非常吸引人外,在生活中也是最常見(jiàn)到的。實(shí)際上普通的用戶使用相機(jī)絕大多數(shù)用于拍攝人物。在個(gè)人愛(ài)好上,有的人可能并不怎么喜歡拍攝人像,覺(jué)得不用關(guān)心這個(gè)問(wèn)題,然而要完全避免人像拍攝幾乎是不可能的,除了偶爾要為朋友和家人拍點(diǎn)生活旅游照外,還要應(yīng)付外出時(shí)需要你幫忙拍照的陌生人:想想如果背著一堆器材的你,在熱切的盼望下卻拍出了極為失敗的照片,那是多么丟臉的一件事啊。因此不管從哪一個(gè)角度來(lái)說(shuō),只要你擁有相機(jī),就應(yīng)該掌握一點(diǎn)人像攝影的常識(shí)。這篇東西試圖闡述一些基本的概念,以幫助大家掌握人像攝影的基本點(diǎn)。要注意的是,本文針對(duì)的是初學(xué)者,希望能幫助避免大多數(shù)導(dǎo)致失敗的因素,但要真正拍出出色的照片,卻要靠大家自己的努力了。
標(biāo)簽:
上傳時(shí)間:
2013-12-27
上傳用戶:refent
-
We have a group of N items (represented by integers from 1 to N), and we know that there is some total order defined for these items. You may assume that no two elements will be equal (for all a, b: a<b or b<a). However, it is expensive to compare two items. Your task is to make a number of comparisons, and then output the sorted order. The cost of determining if a < b is given by the bth integer of element a of costs (space delimited), which is the same as the ath integer of element b. Naturally, you will be judged on the total cost of the comparisons you make before outputting the sorted order. If your order is incorrect, you will receive a 0. Otherwise, your score will be opt/cost, where opt is the best cost anyone has achieved and cost is the total cost of the comparisons you make (so your score for a test case will be between 0 and 1). Your score for the problem will simply be the sum of your scores for the individual test cases.
標(biāo)簽:
represented
integers
group
items
上傳時(shí)間:
2016-01-17
上傳用戶:jeffery
-
The XML Toolbox converts MATLAB data types (such as double, char, struct, complex, sparse, logical) of any level of nesting to XML format and vice versa.
For example,
>> project.name = MyProject
>> project.id = 1234
>> project.param.a = 3.1415
>> project.param.b = 42
becomes with str=xml_format(project, off )
"<project>
<name>MyProject</name>
<id>1234</id>
<param>
<a>3.1415</a>
<b>42</b>
</param>
</project>"
On the other hand, if an XML string XStr is given, this can be converted easily to a MATLAB data type or structure V with the command V=xml_parse(XStr).
標(biāo)簽:
converts
Toolbox
complex
logical
上傳時(shí)間:
2016-02-12
上傳用戶:a673761058
-
這篇c 語(yǔ)言難點(diǎn)分析整理文檔主要是介紹一些在學(xué)習(xí)C 語(yǔ)言的過(guò)程中,個(gè)人認(rèn)為比較重要之處。較好地掌
握這些重點(diǎn)會(huì)使對(duì)C 語(yǔ)言的運(yùn)用更加得心應(yīng)手。此外會(huì)包括一些細(xì)節(jié)、易錯(cuò)的地方。
涉及的主要內(nèi)容包括:變量的作用域和存儲(chǔ)類別、函數(shù)、數(shù)組、字符串、指針、文件、
鏈表等。
一些最基本的概念在此就不多作解釋了,希望能給C語(yǔ)言的初學(xué)者提供一點(diǎn)點(diǎn)的幫助。
標(biāo)簽:
語(yǔ)言
分
文檔
過(guò)程
上傳時(shí)間:
2016-03-01
上傳用戶:cc1015285075