#include <iostream> #include <cmath> using namespace std; int main() { int number; cin >> number; if (number < 2) return 0; int front; cin >> front; int after; cin >> after; int temp = after; int min = abs(front-after); //cout << min << endl; number = number - 2; while (number--) { int temp2; cin >> temp2; if (abs(temp2 - temp)< min) { //cout << abs(temp2 - temp) << endl; min = abs(temp2 - temp); front = temp; after = temp2; } temp = temp2; } cout << front <<" "<< after << endl; system("pause"); return 0; }
点赞 评论

相关推荐

03-28 16:43
佛山大学 Java
不知该咋办:简历2.0,各位佬看看,这样可以吗查看图片
点赞 评论 收藏
分享
最喜欢秋天的火龙果很...:第一份工作一定要往大的去,工资低点没事。后面换工作会更好找,即使你去小公司,你也不可能不会换工作的。所以找大的去
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务