MayanCalendar
below given code is for apcer spoj or mayancalender spoj.
code in function first found unlucky day by calculation of JND%7 variable and calculation of JND I actually don't know how it come i just see this some where in vedic math .After that we found unlucky day so we can easily calculate lucky days by subtracting it from total days between that particulars years.After calculation of lucky days is simple............you can do it.........("_")#include<stdio.h> long long Lucy_Days(int year1,int year2) { int i,j,count=0,JND,day=21; long long total=0; for(i=year1;i<=year2;i++) for(j=1;j<=12;j++) { JND = \ day \ + ((153 * (j + 12 * ((14 - j) / 12) - 3) + 2) / 5) \ + (365 * (i + 4800 - ((14 - j) / 12))) \ + ((i + 4800 - ((14 - j) / 12)) / 4) \ - ((i + 4800 - ((14 - j) / 12)) / 100) \ + ((i + 4800 - ((14 - j) / 12)) / 400) \ - 32045; if(JND%7==4) count++; } for(i=year1;i<=year2;i++) { if((i%4 == 0 && i % 100 != 0)|| i%400==0) total=total+366; else total=total+365; } return (total-count); } int main() { int t; scanf("%d",&t); while(t--){ int year1,year2,i; scanf("%d%d",&year1,&year2); long long lucy=Lucy_Days(year1,year2); int A[5]={0,0,0,0,0}; for(i=4;i>=0;i--) { if(i==3){ A[i] = lucy%18; lucy = lucy /18; } else { A[i] = lucy % 20; lucy = lucy / 20; } } for(i=0;i<=4;i++) { if(i==0) printf("%d",A[i]); else printf(".%d",A[i]); } printf("\n"); } }
Wow it works .........
ReplyDelete