摘要:
这道题是要我们找出所有蚂蚁中最靠近端点和最靠近中间的蚂蚁所在的位置,计算端点的蚂蚁爬到另一个端点的时间和计算靠近中间的蚂蚁爬到离他近的端点的时间。我们只需分输入的位置在棒的左边还是右边来讨论就行。#include<iostream>using namespace std;int main(){ int cas; int l, n, a; cin >> cas; while( cas --) { cin >> l >> n; int ans, earliest = 0, latest = 0; while( n --) ... 阅读全文
posted @ 2011-11-04 14:41
找回失去的
阅读(238)
评论(0)
推荐(0)
摘要:
#include<stdio.h>#include<string.h>char ch[105][105];int main(){ int cnt = 0, ans = 0; while( gets(ch[cnt])) { int len = strlen( ch[cnt]); if( len > ans) ans = len; cnt ++; } for(int j = 0; j < ans; j ++) { for( int i = cnt - 1; i >= 0; i --) { ... 阅读全文
posted @ 2011-11-04 13:01
找回失去的
阅读(551)
评论(0)
推荐(0)
浙公网安备 33010602011771号