[乱搞] BZOJ 2296 [POJ Challenge] 随机种子
2016-04-07 18:46
417 查看
乱搞题
既然要0~9 那么就摆在前面,后面六位补齐使得是倍数就行了
10+6 刚好等于 16
既然要0~9 那么就摆在前面,后面六位补齐使得是倍数就行了
10+6 刚好等于 16
#include<cstdio> #include<cstdlib> using namespace std; typedef long long ll; inline char nc() { static char buf[100000],*p1=buf,*p2=buf; if (p1==p2) { p2=(p1=buf)+fread(buf,1,100000,stdin); if (p1==p2) return EOF; } return *p1++; } inline void read(ll &x) { char c=nc(),b=1; for (;!(c>='0' && c<='9');c=nc()) if (c=='-') b=-1; for (x=0;c>='0' && c<='9';x=x*10+c-'0',c=nc()); x*=b; } const ll Base=9876543210000000; int main() { ll Q,num; freopen("t.in","r",stdin); freopen("t.out","w",stdout); read(Q); while (Q--) { read(num); if (!num) printf("-1\n"); else printf("%lld\n",Base+(num-Base%num)); } return 0; }
相关文章推荐
- android学习之网络连接2
- swustOJ 1615寻宝
- android中listview最后一个item没有下横线的原因?
- Android高级UI之ViewPager实现页卡的最新方法-简洁的TabLayout
- js--引用类型单体内置对象--Math,随机数生成
- C#语言中提供了枚举和整型之间的强制转换功能(SelectItem)
- Jquery开发插件
- 归并排序
- c语言基础概念(3)
- 从 NSURLConnection 到 NSURLSession
- 实战iOS7之NSURLSession
- 替换目标string 中的某些 string的方法。
- js定义对象的方法和继承的方法
- spring-mvc.xml参考
- uint8_t / uint16_t / uint32_t /uint64_t
- swift 中String常用操作
- ConcurrentHashMap原理分析
- java实现SHA1签名加密
- [贪心] BZOJ 3671 [Noi2014]随机数生成器
- LCS算法&最大公共子串&最长公共子序列 PHP 实现