// 1.
#include "stdio.h"
int mystrlen(char *s)
{
int n = 0;
while (*s++) ++n;
return n;
}
int main1()
{
int i;
int inCount = 0;
char str[50][60];
scanf("%d", &inCount);
for (i = 0; i < inCount; ++i){
scanf("%s", str[i]);
}
for (i = 0; i < inCount; ++i){
printf("%d\n", mystrlen(str[i]));
}
return 0;
}
// 2.
void mergestr(char *s1, char* s2, char* result)
{
int i, k = 0;
while (*s2) ++s2;
s2 -= 3;
for (i = 0; i < 3; result[k++] = s1[i++]);
for (i = 0; i < 3; result[k++] = s2[i++]);
}
int main2()
{
int i;
int inCount = 0;
char res[20] = {};
char str[50][60];
scanf("%d", &inCount);
for (i = 0; i < inCount; ++i){
scanf("%s", str[i * 2]);
scanf("%s", str[i * 2 + 1]);
}
for (i = 0; i < inCount; ++i){
mergestr(str[i * 2], str[i * 2 + 1], res);
printf("%s\n", res);
}
return 0;
}
//3.
void encodestr(char *s)
{
char ch;
for (; ch = *s; ++s){
if ('A' <= ch && ch <= 'Z'){
*s = 'A' + (((ch - 'A') + 4) % 26);
}
else if ('a' <= ch && ch <= 'z'){
*s = 'a' + (((ch - 'a') + 4) % 26);
}
}
}
int main3()
{
int i;
int inCount = 0;
char str[50][60];
scanf("%d", &inCount);
for (i = 0; i < inCount; ++i){
scanf("%s", str[i]);
}
for (i = 0; i < inCount; ++i){
encodestr(str[i]);
printf("%s\n", str[i]);
}
return 0;
}
//4.
void delblack(char* s)
{
char* d = s;
while (*s){
if (*s != ' ') *d = *s;
}
*d = '\0';
}
#include <conio.h>
int main4()
{
int i;
int inCount = 0;
char str[50][60];
scanf("%d", &inCount);
gets(str[0]);
for (i = 0; i < inCount; ++i){
gets(str[i]);
}
for (i = 0; i < inCount; ++i){
delblack(str[i]);
printf("%s\n", str[i]);
}
return 0;
}
//5.
void changid(char* s)
{
int xishu[] = { 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 };
const char* mapch ="10X987654321";
int sum = 0;
int i = 0;
char* d = s + 16;
for (i = 15 - 6; i--; *d = *(d - 2), --d);
*(d - 1) = '1';
*d = '9';
for (i = 0; i < 17; i++){
sum += (s[i] - '0') * xishu[i];
}
s[17] = mapch[sum%11];
}
int main5()
{
int i;
int inCount = 0;
char str[20][60] = { {} };
scanf("%d", &inCount);
for (i = 0; i < inCount; ++i){
scanf("%s", str[i]);
}
for (i = 0; i < inCount; ++i){
changid(str[i]);
printf("%s\n", str[i]);
}
return 0;
}
//6.
int calcnumber(int m, int n)
{
int i;
int mul1 = 1;
int mul2 = 1;
int mul3 = 1;
for (i = 1; i <= m; mul1 *= i, ++i);
for (i = 1; i <= n; mul2 *= i, ++i);
for (i = 1; i <= (m-n); mul3 *= i, ++i);
return mul1 / (mul2 * mul3);
}
int main6()
{
int i;
int inCount = 0;
int num[50][2];
scanf("%d", &inCount);
for (i = 0; i < inCount; ++i){
scanf("%d %d", &num[i][0], &num[i][1]);
}
for (i = 0; i < inCount; ++i){
printf("%d\n", calcnumber(num[i][0], num[i][1]));
}
return 0;
}
//7.
int isprime(int n)
{
for (int i = 2; i*i <= n; i++)
if (n%i == 0) return 0;
return n > 1;
}
int caclprimer(int n, int m)
{
int i, s = 0;
for (i = n; i <= m; i++){
if (isprime(i)){
s += i;
}
}
return s;
}
int main7()
{
int m, n;
scanf("%d %d", &n, &m);
printf("%d\n", caclprimer(n, m));
return 0;
}
void main()
{
printf("1t.\n"); main1();
printf("2t.\n"); main2();
printf("3t.\n"); main3();
printf("4t.\n"); main4();
printf("5t.\n"); main5();
printf("6t.\n"); main6();
printf("7t.\n"); main7();
}