栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

zoj 2632 Knight in Corridor

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

zoj 2632 Knight in Corridor

#include <iostream>#include <string.h>#include <algorithm>#include <cstdio>using namespace std;int n , x , y , ans , L , R;int get_len( int L , int R ){ return( ( L/4+R/4 )*4 ); }void work1(){if ( L >= 4 || R >= 4 ) ans = 4;if ( L >= 3 && R >= 2 ) ans = max( ans , get_len( L-3 , R+2 ) );if ( R >= 3 && L >= 2 ) ans = max( ans , get_len( L+2 , R-3 ) ); }void work2() {if ( L >=2 && R >= 2 ) ans = 4;if ( L >= 1 ) ans = max( ans , get_len( L-1 , R ) );if ( R >= 1 ) ans = max( ans , get_len( L , R-1 ) );}int main(){while ( 1 ){scanf( "%d" , &n );if ( n == 0 ) break;scanf( "%d %d" , &x , &y );L = x; R = n-x;ans = 0;if ( y != 1 ) work2();else  work1();if ( ans == 0 ) printf( "wuwuwun" );else printf( "%d.00n" , ans );}}
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/377180.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号