2021/2/20 CCF演習201712(C ++)

201712-1
#include
using namespace std;
#define MAX 10000
int a [MAX];
int main()
{ int n; cin >> n; for(int i = 0; i <n; i ++)cin >> a [i]; int min = MAX; for(int i = 0; i <n; i ++)for(int j = i + 1; j <n; j ++){ int temp; temp = a [i] -a [j]; if(temp <0)temp = 0-temp; if(temp <= min)min = temp; } cout << min << endl; 0を返します。} 201712-2(!!!)#include using namespace std; #include int main(){ int n、k、num = 1; キューリスト; cin >> n >> k;



























for(int i = 1; i <= n; i ++)
list.push(i);
while(list.size()> 1)
{ int top = list.front(); list.pop(); if(num%k!= 0 &&(num%10)!= k){ list.push(top); } num ++; } cout << list.front()<< endl; 0を返します。}










おすすめ

転載: blog.csdn.net/qq_40395925/article/details/113884365