博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
hdoj 5666 Segment(欧拉函数)
阅读量:6416 次
发布时间:2019-06-23

本文共 1024 字,大约阅读时间需要 3 分钟。

Segment

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)

Total Submission(s): 1012    Accepted Submission(s): 368

Problem Description
    Silen August does not like to talk with others.She like to find some interesting problems.
    Today she finds an interesting problem.She finds a segment x+y=q.The segment intersect the axis and produce a delta.She links some line between (0,0) and the node on the segment whose coordinate are integers.
    Please calculate how many nodes are in the delta and not on the segments,output answer mod P.
 

 

Input
    First line has a number,T,means testcase number.
    Then,each line has two integers q,P.
    q is a prime number,and 2q1018,1P1018,1T10.
 

 

Output
    Output 1 number to each testcase,answer mod P.
 

 

Sample Input
1 2 107
 

 

Sample Output
0
 

 

Source
 

 

Recommend
wange2014   |   We have carefully selected several similar problems for you:          
n*phi(n)/2;  n为质数 所以phi(n)= n-1;  推得结果为n*phi(n)/2-phi(n)  --> (n-2)*phi(n)/2; --> (n-2)*(n-1)/2;
 

转载于:https://www.cnblogs.com/soTired/p/5412437.html

你可能感兴趣的文章
送给即将踏入软考征途的你
查看>>
要命啦!Word中快速录入大全,内含快捷键小技巧,快来一起学习!
查看>>
javascript实现音频mp3播放
查看>>
html5-离线缓存
查看>>
linux系统安装完后的常见工作
查看>>
在Linux服务器、客户端中构建密钥对验证进行远程连接
查看>>
揪出MySQL磁盘消耗迅猛的真凶
查看>>
和“C”的再遇
查看>>
一键安装kubernetes 1.13.0 集群
查看>>
RabbitMq的集群搭建
查看>>
spring boot + mybatis 同时访问多数据源
查看>>
URL中汉字转码
查看>>
[转]go正则实例
查看>>
Selector中关于顺序的注意事项
查看>>
font-size: 62.5% 的含义
查看>>
小黑小波比.清空<div>标签内容
查看>>
Java中的ExceptionInInitializerError异常及解决方法
查看>>
Spring 注入bean时的初始化和销毁操作
查看>>
java线程同步原理(lock,synchronized)
查看>>
MyEclipse中使用Hql编辑器找不到Hibernate.cfg.xml文件解决方法
查看>>