include stdio include stdlib include math int main int argc char argv

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(int argc, char *argv[])
{
int miniflag=0, a=1000, god=0, i, cyrs, dopprov;
char s[10];
printf(" ¢¢¥¤¨â¥ áâப㠢 ¢¨¤¥: ¡ãª¢  ä ªã«ìâ¥â -­®¬¥à £à㯯ë-¯à®¡¥«-£®¤\n ¯à¨¬¥à: ˆ944 2014\n "); /* òóò íàïèñàíî: "ââåäèòå ñòðîêó â âèäå: áóêâà ôàêóëüòåòà-íîìåð ãðóïïû-ïðîáåë-ãîä\n ïðèìåð: È944 2014\n" */
do
{ if(miniflag>0)
printf(" ¢ë ¢¢¥«¨ ¤ ­­ë¥ ­¥ª®à४⭮, ¯®¯à®¡ã©â¥ ¥é¥ à § : \n" );/* âû ââåëè äàííûå íå êîððåêòíî, ïîïðîáóéòå åùå ðàç */
gets(s);
miniflag++;
}
while( !((s[0]>=' ' && s[0]<='ï') || (s[0]>='€' && s[0]<='Ÿ'))
|| !(s[1]>='0' && s[1]<='9')
|| !(s[2]>='0' && s[2]<='9')
|| !(s[3]>='0' && s[3]<='9')
|| !(s[4]==' ')
|| !(s[5]>='0' && s[5]<='9')
|| !(s[6]>='0' && s[6]<='9')
|| !(s[7]>='0' && s[7]<='9')
|| !(s[8]>='0' && s[8]<='9') );
printf(" ª ä¥¤à : %c%c\n", s[0],s[1]); /* êàôåäðà */
printf(" £à㯯a: %c\n", s[3]); /* ãðóïïà */
for( i=5; i<9; i++)
{
god+=a*( s[i]-'0');
a/=10;
}
dopprov=(s[7]-'0')*10+(s[8]-'0')-(s[2]-'0');
if(s[2]<=s[8] )
{
cyrs=god-(s[8]-'0')+(s[2]-'0');
god=god-cyrs+1;
printf(" £®¤ ¯®áâ㯫¥­¨ï: %d\n",cyrs);
if(god==1)
printf(" ªãàá: 1\n ");
else if(god<7 && god>0 )
printf(" ªãàá: 2-© ᥬ¥áâà %d-£® ¨«¨ 1-© ᥬ¥áâà %d-£® ªãàá \n ", god-1,god); /* êóðñ */
else if(god==7)
printf(" ªãàá: 6\n ");
else if(god>7)
printf(" £à㯯  ¢ë¯ãá⨫ áì\n ");
}
else if(dopprov>0)
{
god-=dopprov;
printf(" £®¤ ¯®áâ㯫¥­¨ï: %d\n", god);
printf(" ªãàá: 2-© ᥬ¥áâà %d-£® ¨«¨ 1-© ᥬ¥áâà %d-£® ªãàá \n ", dopprov,dopprov+1);
}
else
{
cyrs=god-10+(s[2]-'0');
printf(" £®¤ ¯®áâ㯫¥­¨ï: %d\n ", cyrs); /* ãîä ïîñòóïëåíèÿ:*/
printf(" £à㯯  ¢ë¯ãá⨫ áì\n ");
}
system("PAUSE");
return 0;
}