CodeForces 32C. Flea 水题
2 seconds
256 megabytes
standard input
standard output
It is known that fleas in Berland can jump only vertically and horizontally, and the length of the jump is always equal to s centimeters. A flea has found herself at the center of some cell of the checked board of the size n × m centimeters (each cell is 1 × 1 centimeters). She can jump as she wishes for an arbitrary number of times, she can even visit a cell more than once. The only restriction is that she cannot jump out of the board.
The flea can count the amount of cells that she can reach from the starting position (x, y). Let's denote this amount by dx, y. Your task is to find the number of such starting positions (x, y), which have the maximum possible value of dx, y.
The first line contains three integers n, m, s (1 ≤ n, m, s ≤ 106) — length of the board, width of the board and length of the flea's jump.
Output the only integer — the number of the required starting positions of the flea.
2 3 1000000
6
3 3 2
4 题意:大概就是讲的有一只青蛙,可以在n*m的格子上乱跳,每次最多跳S,问能够跳最多次数的起点总共能有多少个
题解:拿草稿本稍微画画,然后乱搞应该就可以了= =
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0) const int inf=0x7fffffff; //无限大
int main()
{
ll n,m,s;
while(cin>>n>>m>>s){
if(m>n)
swap(n,m);
ll ans=((n-)/s+)*((m-)/s+)*((n-)%s+)*((m-)%s+);
cout<<ans<<endl;
}
return ;
}
CodeForces 32C. Flea 水题的更多相关文章
- Codeforces数据结构(水题)小结
最近在使用codeblock,所以就先刷一些水题上上手 使用codeblock遇到的问题 1.无法进行编译-------从setting中的编译器设置中配置编译器 2.建立cpp后无法调试------ ...
- CodeForces 705A Hulk (水题)
题意:输入一个 n,让你输出一行字符串. 析:很水题,只要判定奇偶性,输出就好. 代码如下: #pragma comment(linker, "/STACK:1024000000,10240 ...
- CodeForces 705B (训练水题)
题目链接:http://codeforces.com/problemset/problem/705/B 题意略解: 两个人玩游戏,解数字,一个数字可以被分成两个不同或相同的数字 (3可以解成 1 2) ...
- codeforces hungry sequence 水题
题目链接:http://codeforces.com/problemset/problem/327/B 这道题目虽然超级简单,但是当初我还真的没有想出来做法,囧,看完别人的代码恍然大悟. #inclu ...
- codeforces 377A. Puzzles 水题
A. Puzzles Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset/problem/33 ...
- CodeForces 474B Worms (水题,二分)
题意:给定 n 堆数,然后有 m 个话询问,问你在哪一堆里. 析:这个题是一个二分题,但是有一个函数,可以代替写二分,lower_bound. 代码如下: #include<bits/stdc+ ...
- CodeForces - 682B 题意水题
CodeForces - 682B Input The first line of the input contains a single integer n (1 ≤ n ≤ 100 000) — ...
- CodeForces 32C Flea
题目链接:http://codeforces.com/problemset/problem/32/C 本文链接:http://www.cnblogs.com/Ash-ly/p/5513436.html ...
- CodeForces 709A Juicer (水题, 模拟)
题意:给定 n 个桔子的大小,一个杯子的容积,一个最大限度,挨着挤桔子汁,如果大小大于限度,扔掉,如果不杯子满了倒掉,问你要倒掉多少杯. 析:直接按要求模拟就好,满了就清空杯子. 代码如下: #pra ...
随机推荐
- Splay算法摘要
先介绍变量定义 int n; struct Node { //Splay节点定义 ],val,num,siz; //fa:它爸爸:son它儿子,左0右1:val:这个节点的值 //num:这个值的数量 ...
- python 之sqlite3库学习
# -*- coding:utf-8 -*- # 导入SQLite驱动:>>> import sqlite3# 连接到SQLite数据库# 数据库文件是test.db# 如果文件不存 ...
- UrlRouteModule
一.请求流程 当一个请求发往ASP.net MVC站点时的情景,IIS收到请求并将请求转到ASP.net,然后根据URL,或者更确切来说:被请求文件的扩展名.在IIS7 integrated模式下(默 ...
- table中的td等长(不随内容大小变化)
使用的table时候发现td的长度是随着内容的大小而变化的,但是有的时候我们不希望这样.想要td等长可以在 tbale中加上 style=“table-layout:fixed” ...
- Flask form
用户登录 #!/usr/bin/env python # -*- coding:utf- -*- from flask import Flask, render_template, request, ...
- Luogu P2310 【loidc,看看海】
各位大佬都用的排序和杨颙大定理,蒟蒻的我怎么也不会做(瑟瑟发抖),那么,就来一发主席树吧.我们知道线段树可以维护区间,平衡树可以维护值域那么,我们可以用线段树套平衡树来解决这个区间值域的问题线段树套平 ...
- es6之yield
yield 关键字用来暂停和继续一个生成器函数.我们可以在需要的时候控制函数的运行. yield 关键字使生成器函数暂停执行,并返回跟在它后面的表达式的当前值.与return类似,但是可以使用next ...
- hdu 4349 求C(n,0),C(n,1),C(n,2)...C(n,n).当中有多少个奇数 (Lucas定理推广)
Lucas定理:把n写成p进制a[n]a[n-1]a[n-2]...a[0],把m写成p进制b[n]b[n-1]b[n-2]...b[0],则C(n,m)与C(a[n],b[n])*C(a[n-1], ...
- hdu 5112 (2014北京现场赛 A题)
给出某个时刻对应的速度 求出相邻时刻的平均速度 输出最大值 Sample Input23 // n2 2 //t v1 13 430 31 52 0 Sample OutputCase #1: 2.0 ...
- jsonrpc.js -- 原生js实现 JSON-RPC 协议
很早以前就涉及到多端远程调用 api的设计,那时候自己设计了个消息传递回调过程.最近了解了JSON-RPC协议,更正规,就可以自己实现下.逻辑也不复杂,没有限制底层消息传递的方式,可以应用到更多的场景 ...