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[0]=a[1];
a[1]=t;
}
if(a[1]>a[2])
{
t=a[1];
a[1]=a[2];
a[2]=t;
}
if(a[0]>a[1])
{
t=a[0];
a[0]=a[1];
a[1]=t;
}
for(i=0;a[i]!=’\0’;i++)
{
printf("%c",a[i]);
if(t!=2)
printf(" “);
}printf(”\n");
}
}
這題主要就是輸出的格式問題,哪裡加空格哪裡不能加,還有換行,然後t應該為字元變數
相關推薦
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
ACM第一次訓練第三題
格式方面除了點問題,導致解決時間過長。。我用的方法是判斷相鄰兩個字母是否相同,如果相同則記錄,再繼續判斷,最後記錄出的值就是取走石頭的數 #include <stdio.h> int main() { int n,i; while (scanf("%d",&n)!=E
ACM第一次訓練第四題
#include <stdio.h> #include <stdlib.h> int main() { int a,b; while(scanf("%d %d",&a,&b)!=EOF) { printf("%d\n
ACM第一次訓練第七題
#include <stdio.h> #include <stdlib.h> #define PI 3.1415927 int main() { double r; while (scanf("%lf",&r)!=EOF) printf("%.3f\n",(r
ACM第一次訓練第一題
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { char a[101]; int i; while (scanf("%s",a)!=EOF) { f
ACM第一期練習題第六小題:ASCII碼排序
click here to have a try first 問題題目: ASCII碼排序 Time limit 1000ms Memory 32768KB 題目訊息: 輸入三個字元後,按各字元的ASCII碼從小到大的順序輸出這三個字元。 Input 輸入資料有多組,每組佔一行,
第一次訓練第七次作業
題目連結:https://vjudge.net/problem/HDU-1106 題目簡述與說明: 1.根據輸入的半徑,計算輸出球的體積; 2.輸入的資料可能有多組 3.輸出的資料保留三位小數 程式說明:與之前不斷輸入a,b求a+b的和一樣,用while()做判斷,利用球的體積公式,
ACM第一期練習題第一小題:String Task
click here to have a try Time limit 2000ms Memory limit 262144KB 題目原題: Petya started to attend programming lessons. On the first lesson his task
ACM第一期練習第四小題:A + B Problem
A+B Problem Calculate A + B. Input Each line will contain two integers A and B. Process to end of file. Output For each case, output A + B in one
ACM第一期練習題第二小題:George and Accommodation
George and Accommodation Time limit 1000ms; Memory limit 262144KB; Problem Description: George has recently entered the BSUCP (Berland State
中石油新生第一次訓練賽 H題掃雷
時間限制: 1 Sec 記憶體限制: 128 MB 提交: 187 解決: 32 題目描述 小Q空的時候挺喜歡玩玩電腦遊戲的。自從程式設計技術提高後,他就想,要是自己也能開發出一款遊戲來,那該多好啊!不過,小Q也不著急,先練好基本功再說。Windows中就有一款叫掃雷的小遊戲,挺好玩的,
第二期訓練第六題(HDU-2019)
問題連結:http://acm.hdu.edu.cn/showproblem.php?pid=2019 問題簡述:在n個有序數中插入一個數字,並使新的序列有序。 Point:包含多個測試例項。 AC程式碼: #include <iostream> using na
第一期訓練題第六題
問題連結:https://vjudge.net/problem/hdu-2000 程式說明:用while語句實現輸入多組資料,用for迴圈和if語句實現字元的ASCII碼從小到大排序。 AC程式碼: #include <iostream> using namespac
【第一組】第六次沖刺例會
高斯模糊 osi log api 9.png 做了 設計 成員 position 開發小組:Neu Old Driver 沖刺經理:何圖 小組成員:李白洋、王彬宇、李恒雨、黃文睿、安迪 1、昨天做了什麽: 黃文睿:高斯模糊的2D效果
第一週 水題 第六題
輸入三個字元後,按各字元的ASCII碼從小到大的順序輸出這三個字元。 Input 輸入資料有多組,每組佔一行,有三個字元組成,之間無空格。 Output 對於每組輸入資料,輸出一行,字元中間用一個空格分開。 Sample Input qwe asd zxc Sample Output e q
ACM第六題
題目:輸入三個字元後,按各字元的ASCII碼從小到大的順序輸出這三個字元。 Input 輸入資料有多組,每組佔一行,有三個字元組成,之間無空格。 Output 對於每組輸入資料,輸出一行,字元中間用一個空格分開。 #include using n
ACM第一期練習題第八小題:A + B Problem Too
click here to have a try first 題目要求: Time limit : 1000 ms Memory : 32768 KB 題目原題: This problem is also a A + B problem,but it has a little dif
ACM第一期練習題第七小題:計算球體積
click here to have a try 問題要求: Time limit 1000ms Memory 32768KB 問題資料: 根據輸入的半徑值,計算球的體積。 Input 輸入資料有多組,每組佔一行,每行包括一個實數,表示球的半徑。 Output 輸出對應的球的體積
中石油新生第三次訓練賽 C題進位制轉換(奇葩解)
題目描述 樂樂正在學進位制轉換,但他老是搞不清楚到底自己是否做對,請你編一程式實現兩種不同進位制之間的資料轉換,幫他檢驗。 輸入 共有三行,第一行是一個正整數,表示需要轉換的數的進位制n(2≤n≤16),第二行是一個n進位制數,若n>10則用大寫字母A~F表示數碼10~15
2018省賽賽第一次訓練題解和ac代碼
代碼 red erl .net 題解 work ber ive numbers 第一次就去拉了點思維很神奇的CF題目 #OriginTitle A CodeForces 607A Chain Reaction B CodeForces 385C