




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、1.短信計(jì)費(fèi)用手機(jī)發(fā)短信,一般一條短信資費(fèi)為0.1元,但限定每條短信的內(nèi)容在70個(gè)字以內(nèi)(包括70個(gè)字)。如果你所發(fā)送的一條短信超過了70個(gè)字,則大多數(shù)手機(jī)會(huì)按照每70個(gè)字一條短信的限制把它分割成多條短信發(fā)送。假設(shè)已經(jīng)知道你當(dāng)月所發(fā)送的每條短信的字?jǐn)?shù),試統(tǒng)計(jì)一下你當(dāng)月短信的總資費(fèi)。#include <set>#include <map>#include <vector>#include <cstdio>#include <cstring>#include <iostream>#include <algorithm&g
2、t;#define ll long long#define inf 2147483647using namespace std;int n;int main() cin >> n; double ans = 0; for(int i = 1; i <= n; i+) int x; cin >> x; ans = ans + (x - 1) / 70 + 1) * 0.1; printf("%.1lfn", ans); return 0;2.集體照醫(yī)學(xué)部口腔3班n位同學(xué)約定拍集體照,n大于1且不超過100。攝影師要求同學(xué)按照身高站成兩排,保證第二
3、排的人身高都要大于等于第一排的人,且第二排的人數(shù)和第一排的人數(shù)相等或者比第一排多一個(gè)人。輸入n位同學(xué)的身高,請問第二排中身高最矮的人的身高是多少?#include <set>#include <map>#include <vector>#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>#define ll long long#define inf 2147483647using namespace std;int
4、n;int a105;int main() while(scanf("%d", &n) if(n = 0)return 0; for(int i = 1; i <= n; i+) cin >> ai; sort(a + 1, a + n + 1); cout << an / 2 + 1 << endl; return 0;3.1020 跳格問題有一種游戲,在紙上畫有很多小方格,第一個(gè)方格為起點(diǎn)(S),最后一個(gè)方格為終點(diǎn)。有一個(gè)棋子,初始位置在起點(diǎn)上,棋子每次可移動(dòng)一次,棋子在起點(diǎn)時(shí),可向前移動(dòng)一個(gè)格子到第二個(gè)方格內(nèi);棋子在其
5、他方格內(nèi)時(shí),可根據(jù)方格內(nèi)的數(shù)字Ni進(jìn)行移動(dòng)。如果Ni大于零,就向前移動(dòng)Ni個(gè)格子;如果Ni小于零,就向后移動(dòng)-Ni個(gè)格子;如果Ni等于零,則此次原地不動(dòng)一次,在下一步移動(dòng)時(shí)可向前移動(dòng)一步到下一個(gè)格子。顯然,如果僅按此方案,會(huì)出現(xiàn)棋子永遠(yuǎn)移動(dòng)不到終點(diǎn)的情形。為防止這種情況發(fā)生,我們規(guī)定,當(dāng)棋子再次來到它曾經(jīng)到過的方格時(shí),它需要原地不動(dòng)一次,在下一步移動(dòng)時(shí)可向前移動(dòng)一步到下一個(gè)格子。按此方案,棋子總能夠走到終點(diǎn)(F)。如果給定一個(gè)方格圖,試求棋子要走多少步才能從起點(diǎn)走到終點(diǎn)。(注:當(dāng)然還可能會(huì)出現(xiàn)向前移動(dòng)Ni個(gè)格子就跑過終點(diǎn)了,則把棋子放到終點(diǎn)上。如果Ni太小,使得棋子向后移動(dòng)跑過了起點(diǎn),則把棋子
6、放到起點(diǎn)上。)(如圖所示,其中S代表起點(diǎn),F(xiàn)代表終點(diǎn))(只有離開后再次來到一個(gè)方格時(shí),才算來到它曾經(jīng)到過的方格,包括起點(diǎn)S)#include <set>#include <map>#include <vector>#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>#define ll long long#define inf 2147483647using namespace std;int n, ans;int
7、a105;bool vis105;void dfs(int x) if(x < 1) x = 1; if(x > n + 2) x = n + 2; if(visx) if(ax)ans += 2; else ans += 1; dfs(x + 1); else visx = 1; if(x = n + 2)return; ans+; dfs(x + ax); int main() scanf("%d", &n); a1 = 1; for(int i = 2; i <= n + 1; i+) cin >> ai; dfs(1); cou
8、t << ans << endl; return 0;4.配對堿基鏈脫氧核糖核酸(DNA)由兩條互補(bǔ)的堿基鏈以雙螺旋的方式結(jié)合而成。而構(gòu)成DNA的堿基共有4種,分別為腺瞟呤(A)、鳥嘌呤(G)、胸腺嘧啶(T)和胞嘧啶(C)。我們知道,在兩條互補(bǔ)堿基鏈的對應(yīng)位置上,腺瞟呤總是和胸腺嘧啶配對,鳥嘌呤總是和胞嘧啶配對。你的任務(wù)就是根據(jù)一條單鏈上的堿基序列,給出對應(yīng)的互補(bǔ)鏈上的堿基序列。#include <set>#include <map>#include <vector>#include <cstdio>#include &l
9、t;cstring>#include <iostream>#include <algorithm>#define ll long long#define inf 2147483647using namespace std;int n;string x;int main() scanf("%d", &n); for(int i = 1; i <= n; i+) cin >> x; for(int j = 0; j < x.length(); j+) if(xj = 'T') xj = 'A&
10、#39; else if(xj = 'A') xj = 'T' else if(xj = 'C') xj = 'G' else xj = 'C' cout << x << endl; return 0;5.打魚還是曬網(wǎng)中國有句俗語叫“三天打魚兩天曬網(wǎng)”。某人從1990年1月1日起開始“三天打魚兩天曬網(wǎng)”,問這個(gè)人在以后的某一天中是“打魚”還是“曬網(wǎng)”。注意要區(qū)分閏年和不是閏年的兩種情況#include <set>#include <map>#include <v
11、ector>#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>#define ll long long#define inf 2147483647using namespace std;int y, m, d;int mm12 = 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31;int tot;int main() cin >> y >> m >> d; for(
12、int i = 1990; i < y; i+) if(i % 4 = 0 && i % 100 != 0) | i % 400 = 0) tot += 366; else tot += 365; for(int i = 1; i < m; i+) if(y % 4 = 0 && y % 100 != 0) | y % 400 = 0) && i = 2) tot += 29; else tot += mmi - 1; tot += (d - 1); if(tot % 5 <= 2) puts("fishing&quo
13、t;); else puts("sleeping"); return 0;6.優(yōu)先隊(duì)列給定一個(gè)初始數(shù)字集合,對其做如下兩種操作:1. 添加一個(gè)新的數(shù)字2. 將集合中當(dāng)前最小的數(shù)字取出(輸出并刪除),如果最小的數(shù)字有多個(gè),只取出其中一個(gè)。#include <set>#include <map>#include <queue>#include <vector>#include <cstdio>#include <cstring>#include <iostream>#include <al
14、gorithm>#define ll long long#define inf 2147483647using namespace std;int n, m;struct data int a200005; int cnt; bool empty() return cnt = 0; void push(int x) a+cnt = x; int p = cnt; while(p > 1 && ap < ap / 2) swap(ap, ap / 2); p = p / 2; int top() return a1; void down(int x) int t
15、 = x << 1; if(t > cnt)return; if(t + 1 <= cnt && at + 1 < at) t+; if(at < ax) swap(at, ax); down(t); void pop() a1 = acnt; cnt-; down(1); q;int main() cin >> n; for(int i = 1; i <= n; i+) int x; cin >> x; q.push(x); cin >> m; char opt15; for(int i = 1;
16、i <= m; i+) scanf("%s", opt); if(opt0 = 'E') if(q.empty() puts("NULL"); else cout << q.top() << endl; q.pop(); else int x; cin >> x; q.push(x); return 0;7. 護(hù)林員蓋房子在一片保護(hù)林中,護(hù)林員想要蓋一座房子來居住,但他不能砍伐任何樹木?,F(xiàn)在請你幫他計(jì)算:保護(hù)林中所能用來蓋房子的矩形空地的最大面積。#include <set>#incl
17、ude <map>#include <queue>#include <vector>#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>#define ll long long#define inf 2147483647using namespace std;int n, m;int ans;int v2525;bool check(int a, int b, int c, int d) for(int i = a;
18、 i <= c; i+) for(int j = b; j <= d; j+) if(vij)return 0; return 1;int main() cin >> n >> m; for(int i = 1; i <= n; i+) for(int j = 1; j <= m; j+) cin >> vij; for(int i = 1; i <= n; i+) for(int j = 1; j <= m; j+) for(int k = i; k <= n; k+) for(int l = j; l <=
19、 m; l+) if(check(i, j, k, l) ans = max(ans, (k - i + 1) * (l - j + 1); cout << ans << endl; return 0;8.汽車限行為了緩解交通壓力、減少空氣污染,B市市政府決定在工作日(周一至周五)對機(jī)動(dòng)車進(jìn)行限行,每輛機(jī)動(dòng)車每周將有一個(gè)工作日不能出行,但周末不限行。假設(shè)該政策從2000年1月1日起開始執(zhí)行。限行安排為:尾號為1和6:周一限行尾號為2和7:周二限行尾號為3和8:周三限行尾號為4和9:周四限行尾號為5、0和字母:周五限行已知2000年1月1日為周六,現(xiàn)在給出一些日期和車牌號
20、,求問該機(jī)動(dòng)車在該天是否限行。#include <set>#include <map>#include <vector>#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>#define ll long long#define inf 2147483647using namespace std;int T;int y, m, d;int mm12 = 31, 28, 31, 30, 31, 30, 31, 31, 3
21、0, 31, 30, 31;int main() cin >> T; while(T-) char ch; cin >> y >> ch >> m >> ch >> d; string s; cin >> s; int day, tot = 0; if(s5 > '9' | s5 < '0')day = 5; else day = (s5 - '0') % 5; if(day = 0)day = 5; for(int i = 2000; i <
22、y; i+) if(i % 4 = 0 && i % 100 != 0) | i % 400 = 0) tot += 366; else tot += 365; for(int i = 1; i < m; i+) if(y % 4 = 0 && y % 100 != 0) | y % 400 = 0) && i = 2) tot += 29; else tot += mmi - 1; tot += (d - 1); if(tot + 6 - 1) % 7 + 1 = day) puts("yes"); else puts
23、("no"); return 0;9.人工智能人工智能一直是計(jì)算機(jī)學(xué)所追求的一個(gè)很高的境界,全世界的計(jì)算機(jī)學(xué)家們至今仍在不斷努力力求達(dá)到這個(gè)境界。這道題也跟“人工智能”有關(guān)。學(xué)過初中物理的同學(xué)都應(yīng)該知道物理學(xué)中的這個(gè)公式P(功率)= U(電壓)* I(電流)。如果給定其中的任意兩個(gè)值,第三個(gè)值都是很容易求的,這個(gè)就是本題的任務(wù)。#include <set>#include <map>#include <vector>#include <cstdio>#include <string>#include <cstring>#include <iostream>#include <algorithm>#define ll long long#define inf 2147483647using namespace std;int T;string s;map<char, double> mp;double get(int x) double v = 0, t = 1; for(int i = x; i < s.length(); i+) if(si >= '0' && si <= '9&
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年茶藝師職業(yè)技能鑒定理論試卷(茶藝師職業(yè)培訓(xùn)師資培訓(xùn)報(bào)告)
- 2025年電梯安裝改造維修作業(yè)特種作業(yè)操作證考試試卷(電梯安全)事故案例分析
- 低碳城市案例研究:2025年城市規(guī)劃與城市更新策略
- 帕力亞多駱駝乳粉知識(shí)測試題
- 2025年基因治療藥物臨床研發(fā)新趨勢:市場前景與產(chǎn)業(yè)布局分析報(bào)告
- 2025年高性能鐵氧體一次磁粉項(xiàng)目規(guī)劃申請報(bào)告
- 汽車工程原理及技術(shù)案例分析題
- 2025年防雷工程項(xiàng)目立項(xiàng)申請報(bào)告
- 金融大數(shù)據(jù)在反欺詐中的機(jī)器學(xué)習(xí)應(yīng)用報(bào)告2025
- 2025年社交媒體平臺(tái)文化影響力報(bào)告:熱點(diǎn)事件與輿論引導(dǎo)效應(yīng)
- 正畸器械知識(shí)培訓(xùn)課件
- 2025年師德師風(fēng)知識(shí)競賽題庫(含參考答案)
- 安裝倉庫燈具協(xié)議書
- 河道養(yǎng)護(hù)工作總結(jié)
- 2025年中質(zhì)協(xié)注冊質(zhì)量經(jīng)理認(rèn)證考試題庫大全(含答案)
- 電纜敷設(shè)施工方案及安全措施完整
- 南京科遠(yuǎn)KD200變頻器使用手冊
- 生產(chǎn)部門員工的技能進(jìn)階及相應(yīng)激勵(lì)機(jī)制設(shè)計(jì)
- WEF -2025全球燈塔網(wǎng)絡(luò):全球燈塔網(wǎng)絡(luò) 推動(dòng)思維轉(zhuǎn)變 數(shù)字轉(zhuǎn)型中的影響和規(guī)模 轉(zhuǎn)變白皮書
- 《三國演義》探究課 課件
- 2025年山西華新燃?xì)饧瘓F(tuán)有限公司招聘筆試參考題庫含答案解析
評論
0/150
提交評論