ACM 第八届山东省赛 I Parity check SDUT 3901
来源:互联网 发布:数据库学籍管理系统 编辑:程序博客网 时间:2024/05/21 22:52
题目再现链接: 点击打开链接
Parity check
Time Limit: 2000MS Memory Limit: 524288KB
Submit Statistic
Problem Description
Fascinated with the computer games, Gabriel even forgets to study. Now she needs to finish her homework, and there is an easy problem:
f(n)=
She is required to calculate f(n) mod 2 for each given n. Can you help her?
Input
Multiple test cases. Each test case is an integer n(0≤n≤) in a single line.
Output
For each test case, output the answer of f(n)mod2.
Example Input
2
Example Output
1
Hint
Author
“浪潮杯”山东省第八届ACM大学生程序设计竞赛(感谢青岛科技大学)
找规律, 会发现%2 每三位 都是0 1 1 因此 看是 %3 余几即可 但又因为是10^1000 因此是个大数 ,大数处理 就行
#include <iostream>#include <algorithm>#include <cmath>#include <cstring>#include <stdio.h>#include <string>using namespace std;int main(){ string s; int sum=0; int i; while(cin>>s) { int len=s.length(); sum=0; for(i=0;i<len;i++) { sum+=(s[i]-'0')%3; } sum%=3; switch(sum) { case 1:printf("1\n");break; case 0:printf("0\n");break; case 2:printf("1\n");break; } } return 0;}
阅读全文
0 0
- ACM 第八届山东省赛 I Parity check SDUT 3901
- 第八届ACM山东省赛 I Parity check
- 山东省第八届ACM省赛 I 题(Parity check)
- 山东省第八届ACM省赛I.Parity check
- 山东省第八届ACM省赛 I 题 Parity check 详解
- 第八届山东省赛题->Parity check
- 山东省第八届 ACM 省赛 Parity check (规律、水)
- 山东省第八届acm大赛 I题 (SDUT 3901)
- 第八届山东省赛题 I Parity check (水题,找规律)
- ACM 第八届山东省赛 F quadratic equation SDUT 3898
- ACM 第八届山东省赛 J company SDUT 3902
- 山东省第八届acm大赛 F题 (SDUT 3898)
- 山东省第八届acm大赛 J题 (SDUT 3902)
- 山东省第八届acm大赛 G题 (SDUT 3899)
- 端午节月赛-山东省第八届省赛 Parity check(找奇偶规律)
- 山东省第八届ACM大赛I题题解
- “浪潮杯”山东省第八届ACM大学生程序设计竞赛I
- 第八届ACM山东省赛 J company
- 1.1 第一个控制台应用程序实例
- 设计原则之旅(一):单一职责
- 0517
- 浏览器的兼容性问题
- Spark2.1.1中用各种模式运行计算圆周率的官方Demo
- ACM 第八届山东省赛 I Parity check SDUT 3901
- 45题埃及分数
- 大数乘方 求高精度幂 NOYJ155
- max-points-on-a-line
- jQuery选择器之类选择器
- 三天打鱼两天晒网(c语言)
- Linux命令基础32-cal命令
- Container With Most Water(能装最多水的容器)
- 64-bit Tips