sdut3260——Single Round Math(大数模)
2017-04-29 19:24
239 查看
Single Round Math
Time Limit: 1000MS Memory Limit: 65536KBSubmit Statistic Discuss
Problem Description
Association for Couples Math (ACM) is a non-profit organization which is engaged in helping single people to find his/her other half. As November 11th is “Single Day”, on this day, ACM invites a large group of singlesto the party. People round together, chatting with others, and matching partners.
There are N gentlemen and M ladies in the party, each gentleman should only match with a lady and vice versa. To memorize the Singles Day, ACM decides to divides to divide people into 11 groups, each group should
have the same amount of couples and no people are left without the groups.
Can ACM achieve the goal?
Input
The first line of the input is a positive integer T. T is the number of test cases followed. Each test case contains two integer N and M (0 ≤ N, M ≤ 10^1000), which are the amount of gentlemen and ladies.
Output
For each test case, output “YES” if it is possible to find a way, output “NO” if not.
Example Input
3 1 1 11 11 22 11
Example Output
NO YES NO
给定n个绅士和m个美女,要求能把他们分成11对,每对一男一女。
a!=b 显然不行。 a%11!=0 显然不行
#include <iostream> #include <cstdio> #include <cstring> #include <queue> #include <cmath> #include <algorithm> #include <vector> #include <map> #include <string> #include <stack> using namespace std; typedef long long ll; #define PI 3.1415926535897932 #define E 2.718281828459045 #define INF 0xffffffff//0x3f3f3f3f #define mod 997 const int M=1005; int n,m; int cnt; int sx,sy,sz; int mp[1000][1000]; int pa[M*10],rankk[M]; int head[M*6],vis[M*100]; int dis[M*100]; ll prime[M*1000]; bool isprime[M*1000]; int lowcost[M],closet[M]; char st1[5050],st2[5050]; int len[M*6]; typedef pair<int ,int> ac; //vector<int> g[M*10]; ll dp[50][1<<10][50]; int has[10500]; int month[13]= {0,31,59,90,120,151,181,212,243,273,304,334,0}; int dir[8][2]= {{0,1},{0,-1},{-1,0},{1,0},{1,1},{1,-1},{-1,1},{-1,-1}}; void getpri() { ll i; int j; cnt=0; memset(isprime,false,sizeof(isprime)); for(i=2; i<1000000LL; i++) { if(!isprime[i])prime[cnt++]=i; for(j=0; j<cnt&&prime[j]*i<1000000LL; j++) { isprime[i*prime[j]]=1; if(i%prime[j]==0)break; } } } struct node { int v,w; node(int vv,int ww) { v=vv; w=ww; } }; vector<int> g[M*100]; char str[100005]; int ind[2550]; int bit[50]; int K; bool judge(string a){//大数取摸 int len=a.length(); int i=0,ans=0; while(i<len){ ans=ans*10+(a[i]-'0'); i++; ans%=11; } return ans==0; } int main() { int i,j,k,t; ll l,r; int cas=0; string a,b; //memset(dp,-1,sizeof(dp)); scanf("%d",&t); while(t--) { cin>>a>>b; if(a!=b){cout<<"NO\n";continue;} if(judge(a))cout<<"YES\n"; else cout<<"NO\n"; } return 0; }
相关文章推荐
- sdut 3260 Single Round Math 模拟
- Single Round Math sdut3260高精度除以低精度
- Single Round Math
- 山东省第六届ACM大学生程序设计竞赛-Single Round Math(大数除法)
- Single Round Math
- 2015山东省第六届ACM省赛 Single Round Math
- 第六届山东省ACM竞赛 J题 Single Round Math
- 第六届省赛J题 single round math
- Math.round(),Math.ceil(),Math.floor()的区别
- Math.round()详解
- C#练习记录(请计算出一个整型数组的平均值。{ 1, 3, 5, 7, 90, 2, 4, 6, 8, 10 }。要求:计算结果如果有小数,则显示小数点后两位(四舍五入)。Math.Round())
- Single Round Match
- Math.round(11.5) 等於多少? Math.round(-11.5) 等於多 少?
- Java中Math.round()
- JavaScript中用于四舍五入的Math.round()方法讲解
- Math.Round四舍五入说明
- Math.Round函数详解
- Math.Round的实现
- Math中的round/ceil/floorf方法总结
- Math.round()什么作用?