解题思路:
注意事项:
参考代码:
import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); while(sc.hasNext()) { int n = sc.nextInt(); int m = sc.nextInt(); if(n==0&&m==0) break; int a[] = new int[n]; a[0] = sc.nextInt(); if(m<a[0]) System.out.print(m+" "+a[0]); else System.out.print(a[0]+" "); for(int i=1;i<a.length;i++) { a[i] = sc.nextInt(); if(m>a[i-1]&&m<a[i]) { System.out.print(m+" "); } System.out.print(a[i]+" "); } } } }
0.0分
1 人评分
C语言程序设计教程(第三版)课后习题6.9 (C语言代码)浏览:779 |
C语言训练-求s=a+aa+aaa+aaaa+aa...a的值 (C语言代码)浏览:696 |
printf基础练习2 (C语言代码)浏览:757 |
整数平均值 (C语言代码)浏览:789 |
C语言程序设计教程(第三版)课后习题8.7 (C语言代码)浏览:808 |
汽水瓶 (C语言代码)浏览:539 |
C语言程序设计教程(第三版)课后习题6.3 (C语言代码)浏览:393 |
WU-DNA (C++代码)浏览:773 |
时间转换 (C语言代码)浏览:838 |
三角形 (C语言代码)浏览:1878 |