点击这里更换您喜欢的皮肤wtboj 首页
请点击这里登入noios   首页 入门 c++讲义 入门教程视频 金牌教程 入门视频 站务 公告 | 题库 记录 竞测 测试 闯关 作业 排名 团队 讨论 | 换肤 | 登入 注册  
News >>   新增功能:各团队管理员可以发布本团队作业了 ()

From sina007
整数分解(版本2)
讨论 Discussion
 
题解
#include<iostream>
using namespace std;
int main(){
freopen("p1240.in","r",stdin);
freopen("p1240.out","w",stdout);
int a,b=1;
bool c=1;
cin>>a;
while(a==0){
if(a==2){
b*=2;
break;
}
if(a==3){
b*=3;
break;
}
if(a%2==0){
b*=2;
a=a-2;
}
if(a%2==1){
c=0;
}
}
if(c){
cout<<b;
}else{
cout<<a-1;
}
fclose(stdin);
fclose(stdout);
return 0;
}
( )

此主题无回复显示
发布讨论主题 回复讨论主题
Flag
  
题号
  P1240
  其它
通过
  30人
提交
  182次
通过率
  16%
难度
  2
提交 讨论 题解
 Copyright wtboj © 2005-2006. www.wutuobang.date Powered by wtboj 关于 联系 帮助
 wtboj Information ---- Total Users : 1242 | Online Users / Processes : 0 / 68 | Processed Time : 51 ms | Server Time : 2025/4/27 17:48:45