解题思路:
注意事项:
参考代码:
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++代码)记忆化搜索浏览:1221 |
C语言程序设计教程(第三版)课后习题3.7 (C语言代码)浏览:262 |
printf基础练习2 (C语言代码)浏览:617 |
1048题解(读入回车问题)浏览:554 |
1054题解浏览:460 |
大神老白 (C语言代码)浏览:600 |
C语言程序设计教程(第三版)课后习题8.4 (C语言代码)浏览:553 |
快速排序算法1浏览:882 |
C语言程序设计教程(第三版)课后习题10.1 (C++代码)浏览:497 |
1074(纳闷了,答案错误,求指教)浏览:362 |