nyoj216

news/2024/11/7 7:36:39/
            A problem is easy时间限制:1000 ms  |  内存限制:65535 KB难度:3描述

When Teddy was a child , he was always thinking about some simple math problems ,such as “What it’s 1 cup of water plus 1 pile of dough ..” , “100 yuan buy 100 pig” .etc..
这里写图片描述
One day Teddy met a old man in his dream , in that dream the man whose name was“RuLai” gave Teddy a problem :

Given an N , can you calculate how many ways to write N as i * j + i + j (0 < i <= j) ?

Teddy found the answer when N was less than 10…but if N get bigger , he found it was too difficult for him to solve.
Well , you clever ACMers ,could you help little Teddy to solve this problem and let him have a good dream ?
输入
The first line contain a T(T <= 2000) . followed by T lines ,each line contain an integer N (0<=N <= 10^11).
输出
For each case, output the number of ways in one line
样例输入
2
1
3
样例输出
0
1
一下子没想到!
看下吧! 代码ac

#include<stdio.h>
int main()
{long long  n,m;scanf("%lld",&m);while(m--){scanf("%lld",&n);int i,s=0;for(i=1;(i+1)*(i+1)<=n+1;i++){if((n+1)%(i+1)==0)s++;}printf("%d\n",s);}return 0;
}

http://www.ppmy.cn/news/206495.html

相关文章

NYOJ116

NYOJ116 注意数组大小 #include <stdio.h> #include <math.h> #include <string.h> typedef struct STU{int grade;//不管是求区间最大值&#xff0c;还是次数&#xff0c;修改的都是grade&#xff0c;也就是grade的求法不同&#xff0c;比如这里是每一个节…

精挑细选 n 263

这题主要是使用一下#include<limits.h>&#xff0c;有点忘了&#xff0c;调了些时间啊&#xff0c;需要练习一下了 #include<stdio.h> #include<limits.h>int main() {int length, radius, data;int N, m;scanf("%d",&N);while(N--){length …

NYOJ 169

素数 时间限制&#xff1a; 3000 ms | 内存限制&#xff1a; 65535 KB 难度&#xff1a; 1 描述 走进世博园某信息通信馆&#xff0c;参观者将获得前所未有的尖端互动体验&#xff0c;一场充满创想和喜悦的信息通信互动体验秀将以全新形式呈现&#xff0c;从观众踏入展馆的第…

第234(22W+6)

豆豆早上好呀&#xff0c;昨天晚上跟外婆闹了&#xff0c;结论是我的妈妈是爱我的&#xff0c;豆豆的妈妈也是爱豆豆的&#xff0c;每个妈妈都爱自己的孩子都心疼自己的孩子咱们一家人要好好地幸福地过日子哦&#xff01; 明天就是周末了&#xff0c;麻麻一定不睡懒觉早点起来…

Nyoj 61

这个是双线程dp&#xff0c;第一次接触这种类型的题&#xff0c;参考别人的思想写的。 参考 #include <iostream> #include <cstring>using namespace std;int MAX(int a, int b) {return a > b ? a : b; }int main() {int T;int Graph[55][55];int row, col;…

161-169

注&#xff1a;以下问题的部分解析并非全部是自己原创&#xff0c;只是为了便于以后复习&#xff0c;直接粘贴总结的答案&#xff0c;主要来源是七月在线中的解析部分。https://www.julyedu.com/question/selectAnalyze/kp_id/4/cate/C 1、下面对于友元函数的描述正确的是&…

m132nw与m132snw差异_对比爆料评测惠普m132snw和m132nw哪个好?区别怎么样?亲测解析实际情况...

这两款区别还是有的哈&#xff0c;款式和配置是不一样的&#xff0c;惠普M132snw更精致点儿&#xff0c;要买哪个&#xff0c;得看个人吧&#xff0c;我自己用的是惠普M132snw&#xff0c;性价比蛮高的&#xff0c;款式也是我喜欢的&#xff0c;颜色好看&#xff0c;整体看着有…

m132nw与m132snw差异_使用测评曝光惠普m132snw和m132nw区别哪个好?区别是?求助大家解密...

这两个区别不是很大的哈&#xff0c;款式和配置是差不多的&#xff0c;惠普M132snw相对来说更精致点&#xff0c;不过家用的话&#xff0c;这两个足够了&#xff0c;看个人需要吧&#xff0c;我自己用的是惠普M132snw&#xff0c;外观很大气&#xff0c;整个看着很上档次&#…