C/C++の宿題を片付けます 115代目at TECH
C/C++の宿題を片付けます 115代目 - 暇つぶし2ch316:デフォルトの名無しさん
08/08/21 19:34:27
>>311
#include<stdio.h>

int main(int argc, char *argv[]){
int i, x, y, width=5, height=5, left=-1, top=-1;
int field[5][5]={
{'#', '#', '#', '#', '#'},
{'#', '#', '#', '#', '#'},
{'#', '#', '#', '*', '*'},
{'#', '#', '#', '*', '*'},
{'#', '#', '#', '*', '*'},
};

for(i=0;i<width+height-1;i++){
for(y=0;y<i;y++){
x=i-y;
if(x<0 || x>=width) continue;
if(field[y][x]=='*'){
left=x;
top=y;
break;
}
}
if(y<i) break;
}
printf("X:%d Y:%d\n", left, top);

return 0;
}


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch