nswoj 带分数
来源:互联网 发布:linux vi编辑命令 编辑:程序博客网 时间:2024/06/15 20:42
点击打开链接
暴力枚举
但是有个函数很方便,枚举组合数。next_permutation()
本来忘了,我的编译器打个next 就直接跳出来了。。编译器强大真好。
#include <bits/stdc++.h>using namespace std;int a[12];int main(){ int n,ans=0; for(int i=1;i<10;++i) a[i]=i; scanf("%d",&n); do{ int b=0,c,d; for(int i=1;i<8;++i){ b=b*10+a[i]; for(int j=2;j<=8;++j){ c=d=0; for(int k=i+1;k<=j;++k) c=c*10+a[k]; for(int k=j+1;k<10;++k) d=d*10+a[k]; if(c%d==0&&n==b+c/d){ ans++;//printf("%d =%d / %d\n",b,c,d); } } } }while(next_permutation(a+1,a+10)); printf("%d\n",ans); return 0;}
0 0
- nswoj 带分数
- 带分数
- 带分数
- 带分数
- 带分数
- 带分数
- 带分数
- 带分数
- 带分数
- 带分数
- 带分数
- 带分数
- 带分数
- 带分数
- 带分数
- 带分数
- 带分数
- 带分数
- unity Editor EditorWindow Grid 使用 笔记
- COGS 1487 麻球繁衍
- 派生类向基类转换的可访问性
- mysql 主从复制
- unity UIanimator
- nswoj 带分数
- Android 中监听WIFI连接状态变化
- orbslam:rgbd_tum源码阅读
- 场景中特效的一种处理方法
- CodeForces
- 【Nginx】编译进去自己的HTTP模块
- PAT-A1102. 二叉树-翻转 层序、中序输出
- 《ACM程序设计》书中题目 Y
- 子网掩码怎么理解