ACM第六題
題目:輸入三個字元後,按各字元的ASCII碼從小到大的順序輸出這三個字元。
Input
輸入資料有多組,每組佔一行,有三個字元組成,之間無空格。
Output
對於每組輸入資料,輸出一行,字元中間用一個空格分開。
#include
using namespace std;
int main()
{
int i, j;
char a[3], temp;
while (cin >> a)
{
for (j = 0; j < 2; j++)
for (i = j; i < 2; i++)
if (a[j] > a[i + 1])
{
temp = a[j];
a[j] = a[i + 1];
a[i + 1] = temp;
}
for (i = 0; i < 3; i++)
{
cout << a[i];
if (i <= 1)
cout <<" ";
}
cout << endl;
}
}
相關推薦
ACM第六題
題目:輸入三個字元後,按各字元的ASCII碼從小到大的順序輸出這三個字元。 Input 輸入資料有多組,每組佔一行,有三個字元組成,之間無空格。 Output 對於每組輸入資料,輸出一行,字元中間用一個空格分開。 #include using n
ACM第一次訓練第六題
#include <stdio.h> #include <stdlib.h> int main() { char a[4]; char t; int=i; while (scanf("%s",a)!=EOF) { if(a[0]>a[1]) {t=a[0]; a
加法變乘法——第六屆藍橋杯C語言B組(省賽)第六題
clu 自己 nbsp 加法 藍橋杯 重新 () std spa 原創 加法變乘法 我們都知道:1+2+3+ ... + 49 = 1225現在要求你把其中兩個不相鄰的加號變成乘號,使得結果為2015 比如:1+2+3+...+10*11+12+...+27*28+29+
2018年藍橋杯B組c/c++ 第六題詳解
標題:遞增三元組 給定三個整數陣列 A = [A1, A2, … AN], B = [B1, B2, … BN], C = [C1, C2, … CN], 請你統計有多少個三元組(i, j, k) 滿足: 1 <= i, j, k <= N Ai <
劍指 offer_第六題_旋轉陣列的最小數字
平臺 牛客網 語言 python2.7.3 作業內容 題目描述 把一個數組最開始的若干個元素搬到陣列的末尾,我們稱之為陣列的旋轉。 輸入一個非減排序的陣列的一個旋轉,輸出旋轉陣列的最小元素。 如陣列 {3,4,5,1,2} 為 {1,2,3,4,5} 的一個旋轉,該陣列的最小
Java實驗 容器試題 第六題
Professor Charles Xavier is having a tough time remembering all the different kinds of X-Men, their power and weakness. With the improvement
"acm第7題"
#include "pch.h" #include <iostream> #include<iomanip> using namespace std; int main() { const double PI = 3.1415927; double r; whi
"acm第8題"
#include "pch.h" #include <iostream> using namespace std; int main() { int A, B; while (cin >> A >> B) { if ((A + B) % 86 =
ACM 第三題
Stones on the Table Time limit2000 ms Memory limit262144 kB There are n stones on the table in a row, each of them can be red, green or blue. Co
第一週 水題 第六題
輸入三個字元後,按各字元的ASCII碼從小到大的順序輸出這三個字元。 Input 輸入資料有多組,每組佔一行,有三個字元組成,之間無空格。 Output 對於每組輸入資料,輸出一行,字元中間用一個空格分開。 Sample Input qwe asd zxc Sample Output e q
ACM第四題
題目連結:https://vjudge.net/problem/hdu-1000?tdsourcetag=s_pctim_aiomsg #include <iostream> using namespace std; int main() { int A, B; whil
ACM第三題
題目連結:https://vjudge.net/problem/CodeForces-266A #include <iostream> using namespace std; int main() { int n,i,sum=0; cin >> n; if
ACM第八題
題目連結:https://vjudge.net/problem/HDU-2101 #include <iostream> using namespace std; int main() { int A, B; while (cin >
ACM第七題
根據輸入的半徑值,計算球的體積。 Input 輸入資料有多組,每組佔一行,每行包括一個實數,表示球的半徑。 Output 輸出對應的球的體積,對於每組輸入資料,輸出一行,計算結果保留三位小數。 #include <iostream> u
第一期訓練題第六題
問題連結:https://vjudge.net/problem/hdu-2000 程式說明:用while語句實現輸入多組資料,用for迴圈和if語句實現字元的ASCII碼從小到大排序。 AC程式碼: #include <iostream> using namespac
【劍指offer第六題】旋轉陣列的最小數
題目描述 把一個數組最開始的若干個元素搬到陣列的末尾,我們稱之為陣列的旋轉。 輸入一個非減排序的陣列的一個旋轉,輸出旋轉陣列的最小元素。 例如陣列{3,4,5,1,2}為{1,2,3,4,5}的一個旋
ACM 第八題
A + B Problem Too Time limit 1000 ms Memory limit 32768 kB OS Windows This problem is also a A + B problem,but it has a little difference,you sh
ACM 第七題
計算球體積 Time limit 1000 ms Memory limit 32768 kB OS Windows 根據輸入的半徑值,計算球的體積。 Input 輸入資料有多組,每組佔一行,每行包括一個實數,表示球的半徑。 Output 輸出對應的球的體積,對於每組輸入資料,輸出
ACM 第6題
ASCII碼排序 Time limit 1000 ms Memory limit 32768 kB OS Windows 輸入三個字元後,按各字元的ASCII碼從小到大的順序輸出這三個字元。 Input 輸入資料有多組,每組佔一行,有三個字元組成,之間無空格。 Output 對於
ACM 第四題
A + B Problem Time limit 1000 ms Memory limit 32768 kB OS Windows Calculate A + B. Input Each line will contain two integers A and B. Process