----------模拟----------
xmzyt1996
这个作者很懒,什么都没留下…
展开
-
FOJ 1893 内存管理 //模拟
题目描述内存管理解题思路参考代码#include <iostream> #include <algorithm> #include <vector> #include <string> #include <cstring> #include <map> const int maxn = 110; using namespace std; struct Process{ int begin,s原创 2015-07-26 17:19:31 · 337 阅读 · 0 评论 -
FOJ 1062 洗牌问题 // 找规律,模拟
题目描述Problem 1062 洗牌问题解题思路不难发现,只要a1又回到1,则其他牌也会回到原来的位置,因此只要考虑a1。 找下规律会发现,当a1<=n时,a1的下一个位置的编号是上一个的2倍,即a1*=2;当a1>n时,a1=((a1*=2)-2*n-1),最后记录a1回到1的次数即可。参考代码#include <stdio.h> int main() { int n; whi原创 2015-06-01 22:59:16 · 344 阅读 · 0 评论 -
HDOJ 1002 A + B Problem II //高精度加法
Problem Description I have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B. Input The first line of the input contains an integer T(1<=T<=20) which means the number of test cases. Then T lines follow,原创 2014-12-12 20:39:01 · 324 阅读 · 0 评论 -
HDU 5373 The shortest problem //模拟
题目描述HDOJ 5373 The shortest problem解题思路题目大意: 给一个数n, 比如123, 每次操作后把之前各位数字之和加到末尾 由于1+2+3 = 6 所以 123->1236 类似得到1236->123612->… 问,经过t次操作后,得到的数是否能被11整除.首先需要知道的是,被11整除的性质是”奇偶位的和之差能被11整除”. 然后根据此性质开始模拟操作过程即可原创 2015-08-11 20:47:24 · 319 阅读 · 0 评论 -
HDU 5387 Clock // 模拟
题目描述HDU 5387 Clock解题思路题目大意: 给出时间 hh:mm:ss ,求 时针, 分针, 秒针 两两夹角.我们可以先计算出 0点 与 每根针 的夹角(顺时针方向 , 夹角[0, 360) ) 然后做差即可.参考代码#include <cstdio> inline int abs(int x){return x < 0 ? -x : x;} inline int gcd(int a,原创 2015-08-13 23:30:00 · 385 阅读 · 0 评论