日本搞逼视频_黄色一级片免费在线观看_色99久久_性明星video另类hd_欧美77_综合在线视频

國內最全IT社區平臺 聯系我們 | 收藏本站
阿里云優惠2
您當前位置:首頁 > php開源 > php教程 > 安徽科技學院2014-2015-1學期計算機14級12班《C語言程序設計I》期末考試

安徽科技學院2014-2015-1學期計算機14級12班《C語言程序設計I》期末考試

來源:程序員人生   發布時間:2015-01-19 08:17:21 閱讀次數:3164次

1274 Problem A

10字架

Time Limit:1000MS  Memory Limit:65536K
Total Submit:5 Accepted:4

Description

現在給你1個7*7的正方形,讓你來數1數這個正方形中有多少的10字架。1個10字形為1個10字架,多個個10字架可以相連。

例如:1 1 0 1 0 1 0
1 1 1 1 1 1 1
1 0 1 0 0 1 0
1 0 1 0 0 1 0
1 1 1 1 1 1 1
0 0 1 0 1 1 1
0 1 1 1 1 1 1

中有4個10字架。

Input

輸入第1行有1個數T表示有T組測試數據。
接下來輸入T個7行7列的1個正方形。
每行中的兩個元素用空格隔開。

Output

每組輸出數據有1個數代表有幾個10字架,每組數據占1行。

Sample Input

2
1 1 0 1 0 1 0
1 1 1 1 1 1 1
1 0 1 0 0 1 0
1 0 1 0 0 1 0
1 1 1 1 1 1 1
0 0 1 0 1 1 1
0 1 1 1 1 1 1

0 1 0 1 0 1 1
1 1 1 1 1 1 1
0 1 1 1 0 1 1
1 0 1 1 0 1 1
1 1 0 0 0 0 1
1 1 1 1 1 1 1
0 1 0 0 1 0 1

Sample Output

4
5

Source

[Submit]   [Go Back]   [Status]   [Discuss]

#include<iostream> using namespace std; int main() { int a[8][8]= {0}; int n; cin>>n; while(n--) { for(int i=0; i<7; i++) for(int j=0; j<7; j++) cin>>a[i][j]; int count=0; for(int i=1; i<6; i++) for(int j=1; j<6; j++) if(a[i][j⑴]==1&&a[i][j+1]==1&&a[i+1][j]==1&&a[i⑴][j]==1&&a[i][j]==1)count++; cout<<count<<endl; } return 0; }

1276 Problem B

找數

Time Limit:1000MS  Memory Limit:65536K
Total Submit:180 Accepted:78

Description

很簡單,下面有3個數n,m1,m2,就是讓設計1個程序找出能被m1或被m2整除的個數。

Input

輸入包括多組測試數據,每組數據占1行。
0〈n〈2^31,0〈m1,m2〈=10。

Output

[1,n)中能被滿m1或m2整除的個數
每組數據輸出占1行。

Sample Input

12 2 3

Sample Output

7

Source

[Submit]   [Go Back]   [Status]   [Discuss]

#include<iostream> using namespace std; int main() { int a,b,c; while(cin>>a>>b>>c) { int d=0; for(int i=1; i<a; i++) if(i%b==0||i%c==0) d++; cout<<d<<endl; } return 0; }

1277 Problem C

奇特的碰撞

Time Limit:1000MS  Memory Limit:65536K
Total Submit:11 Accepted:4

Description

1天,1個生物學家發現了1種菌落碰撞的規律;他發現兩個權重M1和M2的菌落碰撞在1起會變成權重為2*sqrt(M1*M2)新菌落,現在培養皿中有1批菌落;現在菌落中產生碰撞,求碰撞以后剩下最后的1個菌落的(最小)權重;
輸入:

Input

第1行輸入1個整數N,表示菌落的數量;隨后有N個數表示菌落的權重;

Output

最后1個菌落的(最?。嘀?;結果保存3位小數;

Sample Input

3
72
30
50

Sample Output

120.000

Source

[Submit]   [Go Back]   [Status]   [Discuss]


#include <iostream> #include<algorithm> #include<cmath> #include<cstdio> double f(double n, double m) { return 2 * sqrt(n * m); } using namespace std; int main() { int n, a[1001]; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); double s = f(a[n - 1], a[n - 2]); for (int i = n - 3; i >= 0; i--) s = f(s, a[i]); printf("%.3lf", s); return 0; }

1279 Problem D


疊硬幣的游戲

Time Limit:2000MS  Memory Limit:65536K
Total Submit:17 Accepted:5

Description

小明把存錢罐里的硬幣倒出來準備買東西,但是買東西之前小明想玩1個游戲,就是想把硬幣疊成1樣的高度,你需要算出最少需要移動的硬幣數,假定初始的硬幣是1層1層的疊好的;
輸入

Input

多組測試數據,以EOF結束,第1行是1個n(1<=n<=50)表示有n堆硬幣;
第2行是n個正整數k(1<=k<=100)表示每堆硬幣的硬幣數量
如果n==0運行結束。

Output

對每組輸入數據有兩行輸出,第1行是1個Case #x,表示x組測試數據,第2行輸出y.表示最小的移動磚塊的數量為y,若無解就輸出No solution

Sample Input

6
5 2 4 1 7 5
2
1 2
4
2 2 2 2
0

Sample Output

Case #1
5
No solution
Case #2
0

Source

[Submit]   [Go Back]   [Status]   [Discuss]

#include<iostream> #include<algorithm> using namespace std; int main() { int n,cas=0;; while( cin>>n) { if(n==0)break; int a[1001],sum=0; for(int i=0; i<n; i++) { cin>>a[i]; sum+=a[i]; } if(sum%n!=0) { cout<<"No solution"<<endl; continue; } else { int tt=sum/n,count=0; sort(a,a+n); for(int i=0; i<n,a[i]<tt; i++) count+=tt-a[i]; cas++; cout<<"Case #"<<cas<<endl; cout<<count<<endl; } } return 0; }

1281 Problem E


奇怪的電話號碼

Time Limit:3000MS  Memory Limit:65536K
Total Submit:105 Accepted:58

Description

1天小明最近接到了1個辣手的任務,他們公司有1個電話簿.但是這是1個奇怪的電話簿,由于它不是用數字記錄電話號碼,而是用數字鍵上所對應的字母來記錄電話號碼(2-abc,3-def,4-ghi,5-jkl,6-mno,7-pqrs,8-tuv,9-wxyz),電話號碼只有11位?,F在你的任務就是幫小明寫1個程序來把這些字母的電話號碼轉化成數字的電話號碼。

Input

第1行輸入1個正整數T(0每組測試數據只有1行,輸入1串字符(字符長度為11);

Output

每組輸出占1行,輸出數字的電話號碼

Sample Input

2
phqghumeayl
nlfdxfircvs

Sample Output

74744863295
65339347287

Source

[Submit]   [Go Back]   [Status]   [Discuss]

#include<iostream> #include<string> using namespace std; int main() { int n; cin>>n; while(n--) { string s; cin>>s; for(int i=0; i<11; i++) { if(s[i]=='a'||s[i]=='b'||s[i]=='c')cout<<"2"; if(s[i]=='d'||s[i]=='e'||s[i]=='f')cout<<"3"; if(s[i]=='g'||s[i]=='h'||s[i]=='i')cout<<"4"; if(s[i]=='j'||s[i]=='k'||s[i]=='l')cout<<"5"; if(s[i]=='m'||s[i]=='n'||s[i]=='o')cout<<"6"; if(s[i]=='p'||s[i]=='q'||s[i]=='r'||s[i]=='s')cout<<"7"; if(s[i]=='t'||s[i]=='u'||s[i]=='v')cout<<"8"; if(s[i]=='w'||s[i]=='x'||s[i]=='y'||s[i]=='z')cout<<"9"; } cout<<endl; } return 0; }

1283 Problem F


數據的處理

Time Limit:4000MS  Memory Limit:65536K
Total Submit:13 Accepted:8

Description

小明先用計算機生成了N個1到1000之間的隨機整數(0〈N≤1000),對其中重復的數字,只保存1個,把其余相同的數去掉,不同的數對應著不同的學生的學號。然后再把這些數從小到大排序,依照排好的順序去找同學做調查。請你協助小明完成“去重”與“排序”的工作。

Input

輸入有3行,第1行動1個正整數T(0第3行有N個用空格隔開的正整數,為所產生的隨機數。

Output

輸出是2行,第1行動1個正整數M,表示不相同的隨機數的個數。第2行動M個用空格隔開的正整數,為從小到大排好序的不相同的隨機數。

Sample Input

1
10
20 40 32 67 40 20 89 300 400 15

Sample Output

8
15 20 32 40 67 89 300 400

Source

[Submit]   [Go Back]   [Status]   [Discuss]

#include<iostream> #include<algorithm> using namespace std; int main() { int n; cin>>n; while(n--) { int m,a[1001]; cin>>m; for(int i=0; i<m; i++) cin>>a[i]; sort(a,a+m); int count=0; for(int i=0; i<m; i++) if(a[i]!=a[i+1]) count++; cout<<count<<endl; for(int i=0; i<m; i++) if(a[i]!=a[i+1]) cout<<a[i]<<" "; cout<<endl; } return 0; }

1284 Problem G


最大值和序號

Time Limit:1000MS  Memory Limit:65536K
Total Submit:142 Accepted:56

Description

輸入n個整數,求這n個數的最大值和序號!

Input

輸入n個整數
有多組數據
T a1 a2....at
...

Output

求這n個數的最大值和序號!
每組數據輸出兩行第1行動最大值,第2行動最大值所在的序號

Sample Input

3
1 2 3
4
1 2 3 3

Sample Output

3
2
3
2 3

Source

[Submit]   [Go Back]   [Status]   [Discuss]

#include<iostream> using namespace std; int main() { int n; while(cin>>n) { int max=0,a[1001]; for(int i=0; i<n; i++) { cin>>a[i]; if(a[i]>max)max=a[i]; } cout<<max<<endl; for(int i=0; i<n; i++) if(a[i]==max) cout<<i<<" "; cout<<endl; } return 0; }

1285 Problem H


集合差

Time Limit:1000MS  Memory Limit:65536K
Total Submit:13 Accepted:10

Description

集合A-B被定義為由所有在A中但不在B中的元素組成的集合。例如A={1,2,3,4,5};B={2,4,6}則C=A-B={1,3,5}

Input

輸入集合A和集合B

Output

輸出集合C

Sample Input

5 1 2 3 4 5
3 2 4 6

Sample Output

3 1 3 5

Hint

數字已有序,集合的輸出格式:集合長度 集合元素1.集合元素2.....

Source

[Submit]   [Go Back]   [Status]   [Discuss]

#include<iostream> using namespace std; int main() { int a[1001],b[1001],m,n; cin>>m; for(int i=0; i<m; i++) cin>>a[i]; cin>>n; for(int i=0; i<n; i++) cin>>b[i]; int k=0,j=0,c[1001]; for(int i=0; i<m; i++) { if(a[i]!=b[j]) { c[k]=a[i]; k++; } else j++; } cout<<k; for(int i=0; i<k; i++) cout<<" "<<c[i]; cout<<endl; return 0; }

1286 Problem I


大寫元音字母

Time Limit:1000MS  Memory Limit:65536K
Total Submit:122 Accepted:73

Description

輸入1個字符串(不含空格)你的任務是將其中的元音字母都轉換成大寫字母并將其輸出!

Input

多組數據輸入
每行長度不超過100

Output

輸出轉換后的單詞

Sample Input

acm
icpc
Ahstu

Sample Output

Acm
Icpc
AhstU

Source

[Submit]   [Go Back]   [Status]   [Discuss]

#include<iostream> #include<string> using namespace std; int main() { string a; while(cin>>a) { for(int i=0; i<a.size(); i++) { if(a[i]=='a')a[i]='A'; if(a[i]=='o')a[i]='O'; if(a[i]=='e')a[i]='E'; if(a[i]=='i')a[i]='I'; if(a[i]=='u')a[i]='U'; } cout<<a<<endl; } return 0; }

1282 Problem J


數的另外一種表示方法

Time Limit:4000MS  Memory Limit:65536K
Total Submit:70 Accepted:45

Description

下面我們定義 f(A) = 1, f(a) = ⑴, f(B) = 2, f(b) = ⑵, ... f(Z) = 26, f(z) = ⑵6;
給你1個x和1個數y;你需要求出y+f(x)的結果;

Input

第1行輸入1個數t(0

Output

y+f(x)的結果;

Sample Input

6
R 1
P 2
G 3
r 1
p 2
g 3

Sample Output

19
18
10
⑴7
⑴4
⑷

Source

[Submit]   [Go Back]   [Status]   [Discuss]

#include<iostream> using namespace std; int main() { int n; cin>>n; while(n--) { char s; int m; cin>>s>>m; if(s>='A'&&s<='Z')cout<<s⑹4+m<<endl; if(s>='a'&&s<='z')cout<<-(s⑼6-m)<<endl; } return 0; }


生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈
程序員人生
------分隔線----------------------------
分享到:
------分隔線----------------------------
關閉
程序員人生
主站蜘蛛池模板: 久久久久久一区二区三区四区别墅 | 免费在线观看 av | 久久av网站| 国产日韩久久 | 午夜性色 | 国产高清网站 | 天堂аⅴ在线最新版在线 | 日韩视频在线一区二区 | 欧美日韩激情 | 极品视频在线 | 久久久97 | 嫩草懂你 | 免费在线观看黄色 | 福利一区二区 | 51久久夜色精品国产麻豆 | 91久久精品一区 | 精品久久久久久久 | 黄色片视频在线观看 | 麻豆视频成人 | 日本淫片 | 国产欧美一区二区精品久导航 | 亚洲精品视频免费 | 99久久这里只有精品 | 秋霞偷拍 | 天天操夜操视频 | 亚洲在线观看视频 | 亚洲一级免费观看 | av高清| 亚洲精品久久久久久一区二区 | 国产搞逼视频 | 久久久久久久久久国产精品 | 欧美国产日韩视频 | 日本在线不卡视频 | 日韩精品久久久久久久软件91 | 亚洲v日韩v综合v精品v | 欧美激情xxxx | 国产一区二区毛片 | 久久国产精品-国产精品 | 成人欧美一区二区 | 看中国黄色毛片 | 亚洲精品久久久一区二区三区 |