- 370 名前:デフォルトの名無しさん mailto:sage [2007/11/12(月) 17:54:23 ]
- >>367先越された
#include<stdio.h> void prArry(const int a[const], size_t sz) { size_t idx = 1; while( idx != sz - 2 ) { if( 2*a[idx] > a[idx-1] + a[idx+1] ) printf("%d\n",a[idx]); ++idx; } return; } void prHeqT(const int a[const], size_t sz) { size_t idx = 0; while( 2*idx <= sz ) { if( a[idx] == a[sz-1-idx] ) printf("%d\n",idx); ++idx; } return; } int main(void) { const int a[] = {1,2,4,1,55,32,1,4,7,6}; prArry(&a[0],sizeof(a)/sizeof(int)); prHeqT(&a[0],sizeof(a)/sizeof(int)); return 0; }
|

|